# IBM Db2 for i

Gives an assistant read-only access to Db2 for i: SELECT queries plus schema, table and index metadata. Useful when you need to make sense of AS/400 data without writing SQL by hand.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 27
- Author: Strom-Capital
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/Strom-Capital/mcp-server-db2i
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/mcp/ibm-db2-for-i

## What it does

The server takes SQL from the model and runs it on IBM i through the IBM i Access ODBC driver. No Java involved. If a box only exposes SSH, switch to the Mapepire driver; JT400 JDBC is the third option. Only SELECT statements pass, results get capped automatically, and a timeout cancels queries that run too long.

Metadata is the other half: libraries, column descriptions, indexes, constraints and views. A single process can hold several connection profiles in `DB2I_PROFILES`, each with its own driver and allowed-library list. Individual tools can be switched off — a metadata-only setup without `execute_query`, for instance.

You need network access to the IBM i host and an account allowed to read the libraries in question. Sensitive columns can be masked in results. The install runs `npx -y mcp-server-db2i` and takes connection details from environment variables, which means the password sits in the client config in plain text — keep that file locked down.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `DB2I_HOSTNAME`, `DB2I_USERNAME`, `DB2I_PASSWORD`, `DB2I_SCHEMA`, `DB2I_PROFILES`, `QUERY_ALLOWED_SCHEMAS`, `DB2I_DRIVER`, `DB2I_JDBC_OPTIONS`, `DB2I_ODBC_OPTIONS`, `DB2I_MAPEPIRE_OPTIONS` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env DB2I_HOSTNAME=<DB2I_HOSTNAME> --env DB2I_USERNAME=<DB2I_USERNAME> --env DB2I_PASSWORD=<DB2I_PASSWORD> --env DB2I_SCHEMA=<DB2I_SCHEMA> --env DB2I_PROFILES=<DB2I_PROFILES> --transport stdio ibm-db2-for-i -- npx -y mcp-server-db2i
```
Replace <…> with your own values. 5 more environment variables are in the server README

### Codex

**Platform CLI**
```bash
codex mcp add ibm-db2-for-i --env DB2I_HOSTNAME=<DB2I_HOSTNAME> --env DB2I_USERNAME=<DB2I_USERNAME> --env DB2I_PASSWORD=<DB2I_PASSWORD> --env DB2I_SCHEMA=<DB2I_SCHEMA> --env DB2I_PROFILES=<DB2I_PROFILES> -- npx -y mcp-server-db2i
```
Replace <…> with your own values. 5 more environment variables are in the server README

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "ibm-db2-for-i": {
            "command": "npx",
            "args": [
                "-y",
                "mcp-server-db2i"
            ],
            "env": {
                "DB2I_HOSTNAME": "<DB2I_HOSTNAME>",
                "DB2I_USERNAME": "<DB2I_USERNAME>",
                "DB2I_PASSWORD": "<DB2I_PASSWORD>",
                "DB2I_SCHEMA": "<DB2I_SCHEMA>",
                "DB2I_PROFILES": "<DB2I_PROFILES>"
            }
        }
    }
}
```
Replace <…> with your own values. 5 more environment variables are in the server README

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "ibm-db2-for-i": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "mcp-server-db2i"
            ],
            "env": {
                "DB2I_HOSTNAME": "<DB2I_HOSTNAME>",
                "DB2I_USERNAME": "<DB2I_USERNAME>",
                "DB2I_PASSWORD": "<DB2I_PASSWORD>",
                "DB2I_SCHEMA": "<DB2I_SCHEMA>",
                "DB2I_PROFILES": "<DB2I_PROFILES>"
            }
        }
    }
}
```
Replace <…> with your own values. 5 more environment variables are in the server README

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e DB2I_HOSTNAME=<DB2I_HOSTNAME> -e DB2I_USERNAME=<DB2I_USERNAME> -e DB2I_PASSWORD=<DB2I_PASSWORD> -e DB2I_SCHEMA=<DB2I_SCHEMA> -e DB2I_PROFILES=<DB2I_PROFILES> ibm-db2-for-i npx -y mcp-server-db2i
```
Replace <…> with your own values. 5 more environment variables are in the server README

## When to use it
- browse libraries and tables on an IBM i system
- pull a sample of Db2 for i rows without long locks
- read column and index definitions before a code change
- reach an IBM i host where only SSH is open
- hide sensitive columns in query output

## Example prompts
- List the libraries on our IBM i system and find tables holding orders
- Describe the columns of table `ORDERS` in library `PRODLIB`
- Run a SELECT for the last 50 rows of `PRODLIB.ORDERS` and show them as a table

## Similar
- [World Monitor](https://affpapa.org/en/nevibecode/mcp/world-monitor.md) — MCP server · ★ 89408
- [Scrapling MCP Server](https://affpapa.org/en/nevibecode/mcp/scrapling-mcp-server.md) — MCP server · ★ 89433
- [MCP Toolbox for Databases](https://affpapa.org/en/nevibecode/mcp/googleapis-mcp-toolbox-for-databases.md) — MCP server · ★ 16717
- [PostHog MCP Server](https://affpapa.org/en/nevibecode/mcp/posthog-mcp-server.md) — MCP server · ★ 40409
- [dbx](https://affpapa.org/en/nevibecode/mcp/dbx.md) — MCP server · ★ 27669
- [Metabase](https://affpapa.org/en/nevibecode/mcp/metabase.md) — MCP server · ★ 49845

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
