Open source · MCP server for Db2 for i

Ask your IBM i in plain language.

Claude, Cursor and other AI assistants can read your Db2 for i data, look up tables and check their own SQL. Read-only by design. It connects through the host servers your IBM i already runs, or over SSH, so there is nothing new to install on the system.

npx mcp-server-db2i

Which customers have the most open orders right now?

describe_tableMYLIB.ORDERHDR

Table note: STATUS = 'O' means open.

execute_queryread-only
SELECT C.NAME, COUNT(*) AS OPEN_ORDERS
FROM MYLIB.ORDERHDR H
JOIN MYLIB.CUSTOMERS C ON C.CUSTNO = H.CUSTNO
WHERE H.STATUS = 'O'
GROUP BY C.NAME
ORDER BY OPEN_ORDERS DESC
FETCH FIRST 3 ROWS ONLY

Three customers account for most of the open orders:

CustomerOpen orders
Acme Tools14
Birch Supply9
Harbor Parts7
Illustration with example data.

What you get

Built for production IBM i systems

The read-only checks are always on. The allowlist, masking and audit log are one setting each. Every control is documented, so your IBM i team can see exactly what is enforced and where.

How it fits together

From a question to Db2 for i and back

The server sits between your AI assistant and the IBM i. Every request passes the same checks, whichever client or driver you use.

  1. AI assistantClaude, Cursor, Claude CodeAny client that speaks the Model Context Protocol.
  2. mcp-server-db2istdio, or HTTP with OAuth
    • Read-only SQL validation
    • Library allowlist
    • Column masking
    • Rate limits and audit log
  3. DriverODBC, JT400 or MapepireHost server ports, or SSH only.
  4. IBM iDb2 for iRuns with the user's own authority. Exit programs still apply.

Install

Pick how you run it

The default ODBC driver needs unixODBC and the IBM i Access ODBC Driver on the machine that runs the server. Nothing is installed on the IBM i.

Add the server to your MCP client config. Claude Desktop, Cursor and Claude Code all use this shape.

{
  "mcpServers": {
    "db2i": {
      "command": "npx",
      "args": ["mcp-server-db2i"],
      "env": {
        "DB2I_HOSTNAME": "ibmi.example.com",
        "DB2I_USERNAME": "${env:DB2I_USERNAME}",
        "DB2I_PASSWORD": "${env:DB2I_PASSWORD}",
        "QUERY_ALLOWED_SCHEMAS": "MYLIB"
      }
    }
  }
}
Client setup guide →

Other options

Which MCP server fits you

IBM maintains its own open-source MCP server for IBM i. Both are free, and they start from different places. Here is how to choose.

This server

A good fit when:

  • You would rather not install or run anything new on the IBM i. It uses the database host servers your system already runs, or a plain SSH login.
  • You want reads only, enforced by the server: a read-only connection, a SQL validator and a library allowlist.
  • Several people share one server and sign in with their own IBM i profiles.
Get started →

IBM's MCP server for IBM i

A good fit when:

  • The Mapepire server already runs on your IBM i, or you are happy to install it.
  • You want its ready-made SQL tool sets for performance, jobs, security and storage.
  • You are building agents with Agno, LangChain or Google ADK, or want its ibmi command-line tool next to the server.
IBM/ibmi-mcp-server on GitHub →

Free, open source, and yours to run

MIT licensed. It runs on your own machines and talks only to your IBM i. Questions, ideas and bug reports are welcome on GitHub.