An MCP server for DB2 for i
I open-sourced an MCP server that lets Claude, Cursor, and other AI tools talk directly to DB2 for i.
I kept copy-pasting table definitions into Cursor. Every time I needed to write a query or understand a schema, I'd open up the database client, grab the column names, and feed them into the chat. This worked, but it felt wrong. The AI should be able to look this up itself.
So I built an MCP server that lets AI assistants talk directly to DB2 for i.
What it does
The mcp-server-db2i package exposes seven tools:
Execute SQL queries. The assistant can run SELECT statements against your IBM i. Ask "show me orders from the last seven days" and it writes the query, executes it, and returns results.
List schemas. "What schemas exist on this system?" becomes a single tool call.
List tables. Browse tables in a schema.
List views. Browse views in a schema.
Describe table structures. Column names, data types, constraints.
List indexes. Shows indexes for a specific table.
Get table constraints. Primary keys, foreign keys, unique constraints.
All read-only. No UPDATE, DELETE, or INSERT. The server refuses to run anything that modifies data.
Setup
Install globally:
npm install -g mcp-server-db2iOr run it through Docker.
Add to your MCP client config:
{
"mcpServers": {
"db2i": {
"command": "mcp-server-db2i",
"args": [],
"env": {
"DB2I_HOSTNAME": "your-ibmi-host.example.com",
"DB2I_USERNAME": "your-username",
"DB2I_PASSWORD": "your-password"
}
}
}
}Under the hood
The server uses the JT400 JDBC driver. Connection pooling keeps things responsive. Results are automatically limited to prevent large result sets.
Limitations
Read-only. Won't write data, modify schemas, or execute stored procedures that change state.
Won't help with RPG programs, CL scripts, or other IBM i artifacts. The scope is database access, not full system administration.
MIT licensed. Fork it if you need more.
Links
- GitHub: github.com/Strom-Capital/mcp-server-db2i
- npm: mcp-server-db2i
More from the blog
Agent context is the new technical debt
Git tracks what changed. With AI-generated code, the reasoning behind it matters more. Entire makes that context durable.

Debugging with AI is a diagnosis problem
Stop asking your AI to fix bugs. Ask it to investigate.

Let AI supervise itself
Wire AI into a development workflow that catches mistakes automatically.
