Skip to content
MCP server

IBM Db2 for i

Read-only SQL and schema inspection for IBM Db2 for i, with allowlists and audit log

Runs locallyStatus and history
Install
Pricing
Open source
Platforms
CLI, self-hosted, API
Runs
Locally
Version
3.8.8
Listing updated
3 days ago

About IBM Db2 for i

IBM Db2 for i is an open-source MCP server for databases. It runs locally on your machine and is started by your AI client.

IBM i shops get a way to put an assistant in front of Db2 for i without giving it write access. A read-only connection and a SQL validator that accepts only queries guard every call, and a timeout cancels runaway statements on the IBM i itself. A validate_query tool parses a statement on the system and checks each table and column against the catalog before anything runs.

You can restrict queries and catalog browsing to chosen libraries, and mask sensitive columns or show only their last four characters. It connects through the IBM i Access ODBC driver by default, JT400 over JDBC, or Mapepire over SSH when only port 22 is open, and one server can reach several systems such as development, test and production, each with its own driver, credentials and allowlist.

It runs over stdio, or over Streamable HTTP at /mcp with OAuth 2.1 so people sign in with their own IBM i profile. Business definitions can be written in YAML, vetted queries become named tools, and every tool call goes to a JSON-line audit log with the SQL hashed by default.

Install

Run in a terminal

claude mcp add mcp-server-db2i --env DB2I_HOSTNAME='<DB2I_HOSTNAME>' --env DB2I_USERNAME='<DB2I_USERNAME>' --env DB2I_PASSWORD='<DB2I_PASSWORD>' -- npx -y mcp-server-db2i

Add to claude_desktop_config.json

{
  "mcpServers": {
    "mcp-server-db2i": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-db2i"
      ],
      "env": {
        "DB2I_HOSTNAME": "<DB2I_HOSTNAME>",
        "DB2I_USERNAME": "<DB2I_USERNAME>",
        "DB2I_PASSWORD": "<DB2I_PASSWORD>"
      }
    }
  }
}

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "mcp-server-db2i": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-db2i"
      ],
      "env": {
        "DB2I_HOSTNAME": "<DB2I_HOSTNAME>",
        "DB2I_USERNAME": "<DB2I_USERNAME>",
        "DB2I_PASSWORD": "<DB2I_PASSWORD>"
      }
    }
  }
}

Add to .vscode/mcp.json

{
  "servers": {
    "mcp-server-db2i": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-db2i"
      ],
      "env": {
        "DB2I_HOSTNAME": "<DB2I_HOSTNAME>",
        "DB2I_USERNAME": "<DB2I_USERNAME>",
        "DB2I_PASSWORD": "<DB2I_PASSWORD>"
      }
    }
  }
}

Add to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "mcp-server-db2i": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-db2i"
      ],
      "env": {
        "DB2I_HOSTNAME": "<DB2I_HOSTNAME>",
        "DB2I_USERNAME": "<DB2I_USERNAME>",
        "DB2I_PASSWORD": "<DB2I_PASSWORD>"
      }
    }
  }
}

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "mcp-server-db2i": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-db2i"
      ],
      "env": {
        "DB2I_HOSTNAME": "<DB2I_HOSTNAME>",
        "DB2I_USERNAME": "<DB2I_USERNAME>",
        "DB2I_PASSWORD": "<DB2I_PASSWORD>"
      }
    }
  }
}

Configuration

  • DB2I_HOSTNAMEIBM i hostname or IPv4 addressRequired
  • DB2I_USERNAMEIBM i user profileRequired
  • DB2I_PASSWORDIBM i passwordRequired
  • DB2I_SCHEMADefault schema (library)
  • DB2I_PROFILESPath to a YAML file of IBM i systems. When set, it replaces the DB2I_* connection variables
  • QUERY_ALLOWED_SCHEMASComma-separated schemas the server may read. Empty disables the check.
  • DB2I_DRIVERDatabase driver: odbc (default, IBM i Access ODBC driver, no Java), jt400 (install node-jt400 next to the server; needs a JDK at install and a JRE at runtime) or mapepire (install @ibm/mapepire-js and ssh2; Mapepire over SSH, needs Java on the IBM i only)
  • DB2I_JDBC_OPTIONSExtra JT400 JDBC properties, semicolon-separated (jt400 and mapepire drivers)
  • DB2I_ODBC_OPTIONSExtra IBM i Access ODBC connection keywords, semicolon-separated (odbc driver)
  • DB2I_MAPEPIRE_OPTIONSSSH and Mapepire settings, semicolon-separated, e.g. hostKey=SHA256:...;agent=true;maxJobs=2 (mapepire driver)

Tools this server provides (1)

Taken from the project documentation; the running server may differ.

validate_query
Parses a statement on the IBM i and checks tables and columns against the catalog before running.

What it does

Read-only enforcement
Read-only connection plus a validator that accepts only queries.
Library allowlist and masking
Limit access to chosen libraries and redact sensitive columns.
Three drivers
ODBC by default, JT400 JDBC, or Mapepire over SSH.
Multiple systems
Dev, test and production profiles with separate credentials.
OAuth 2.1 sign-in
People use their own IBM i profile over HTTP.
Audit log
Each tool call written as one JSON line, SQL hashed by default.
Custom business tools
Turn vetted queries into named tools with bound parameters.

Good for

  • Ask which customers have the most open orders
  • Search tables and columns across libraries
  • Read DDL and look up procedures and functions
  • Give analysts safe read access to production data
  • Pipe tool-call audit lines into a log system

Pricing

Open source

Free, MIT licence

Prices change. Check db2i-mcp.com before you buy.

IBM Db2 for i FAQ

Can it change data?

No. It is read-only by design, with a validator that only accepts queries.

Does anything need installing on the IBM i?

The site says no server install is needed; it uses the host servers already running or SSH.

Which drivers are supported?

IBM i Access ODBC (default), JT400 and Mapepire over SSH.

What licence is it under?

The README badge shows MIT.

How do users authenticate?

Over HTTP it supports OAuth 2.1 or a bearer token; over stdio it uses the DB2I_* environment variables.

Is IBM Db2 for i free?

Yes. IBM Db2 for i is open source, so you can use and self-host it for free.

How do I add IBM Db2 for i to Claude Code?

Run this command in your terminal: claude mcp add mcp-server-db2i --env DB2I_HOSTNAME='<DB2I_HOSTNAME>' --env DB2I_USERNAME='<DB2I_USERNAME>' --env DB2I_PASSWORD='<DB2I_PASSWORD>' -- npx -y mcp-server-db2i

What are the best alternatives to IBM Db2 for i?

The closest alternatives to IBM Db2 for i are Midplane, PlatypusDB, Lorebase, Sovaria and model2data studio.

Alternatives to IBM Db2 for i

  1. Midplane

    MCP server

    Postgres gateway for AI agents with table grants, column masking and approval for writes

    Runs locally
    • Open source
    • 5 GitHub stars
    • Databases
  2. PlatypusDB

    MCP server

    Gives MCP clients access to your PlatypusDB database connections, scoped per agent

    Runs locally
    • Open source
    • Databases
  3. Lorebase

    MCP server

    Lets agents read and change a governed, versioned Postgres knowledge graph

    Runs locally
    • Open source
    • Knowledge and memory
  4. Sovaria

    MCP server

    Manage a Sovaria backend (Postgres, auth, storage, functions) from an AI assistant

    Not checked yet
    • 4 tools
    • Remote
    • Freemium
    • Databases
  5. Generate realistic connected test data, dbt projects and dashboards from a schema

    • Remote
    • Freemium
    • Databases
  6. semlayer

    MCP server

    Infers a semantic layer from your data warehouse and serves it to agents

    Runs locally
    • Free
    • Databases