db2-zos-mcp
v1.0.1
Published
MCP server for IBM DB2 z/OS — connect any MCP-compatible AI assistant to a DB2 z/OS database
Maintainers
Readme
db2-zos-mcp
MCP (Model Context Protocol) server for IBM DB2 z/OS. Connect GitHub Copilot (or any MCP client) to a DB2 z/OS database via environment variables.
Prerequisites
You need IBM Data Server Driver for ODBC and CLI installed on your machine. Download from IBM Fix Central:
After installation, set the IBM_DB_HOME environment variable to the driver path (e.g. C:\Program Files\IBM\IBM DATA SERVER DRIVER).
Usage via npx (no install needed)
npx db2-zos-mcpGitHub Copilot — mcp.json configuration
Add this to your .github/copilot/mcp.json (workspace) or %APPDATA%\GitHub Copilot\mcp.json (user-level).
Option A — connection URL (recommended)
{
"servers": {
"db2-zos": {
"command": "npx",
"args": ["-y", "db2-zos-mcp"],
"env": {
"DB2_URL": "db2://hostname.inps.it:446/DBNAME",
"DB2_USERNAME": "myuser",
"DB2_PASSWORD": "mypassword",
"DB2_SSL": "true",
"DB2_CURRENT_SCHEMA": "MYSCHEMA"
}
}
}
}Option B — individual parameters
{
"servers": {
"db2-zos": {
"command": "npx",
"args": ["-y", "db2-zos-mcp"],
"env": {
"DB2_HOST": "hostname.inps.it",
"DB2_PORT": "446",
"DB2_DATABASE": "DBNAME",
"DB2_USERNAME": "myuser",
"DB2_PASSWORD": "mypassword",
"DB2_SSL": "true",
"DB2_CURRENT_SCHEMA": "MYSCHEMA"
}
}
}
}Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
| DB2_URL | ✅ (or HOST+DB) | — | Connection URL: db2://host:port/database — takes priority over individual params |
| DB2_HOST | ✅ (if no URL) | — | DB2 z/OS hostname or IP |
| DB2_PORT | ❌ | 446 | DB2 port (446 = SSL, 50000 = plain) — ignored when DB2_URL is set |
| DB2_DATABASE | ✅ (if no URL) | — | Database/location name — ignored when DB2_URL is set |
| DB2_USERNAME | ✅ | — | DB2 username |
| DB2_PASSWORD | ✅ | — | DB2 password |
| DB2_SCHEMA | ❌ | — | Default schema for table/column lookups |
| DB2_SSL | ❌ | true | Enable SSL (true/false) |
| DB2_SSL_SERVER_CERTIFICATE | ❌ | — | Path to SSL server certificate file |
| DB2_CURRENT_SCHEMA | ❌ | — | Sets the CURRENT SCHEMA special register |
| DB2_CONNECT_TIMEOUT | ❌ | 30 | Connection timeout in seconds |
| DB2_QUERY_TIMEOUT | ❌ | 60 | Query timeout in seconds |
Available Tools
| Tool | Description |
|---|---|
| db2_read | Execute a read-only SELECT/WITH query |
| db2_write | Execute INSERT/UPDATE/DELETE/DDL — always previews before running |
| db2_get_tables | List tables/views, optionally filtered by schema |
| db2_get_columns | Show column definitions for a table |
| db2_get_schemas | List all non-system schemas |
| db2_test_connection | Verify connectivity with the configured parameters |
Claude Desktop / Other MCP clients
{
"mcpServers": {
"db2-zos": {
"command": "npx",
"args": ["-y", "db2-zos-mcp"],
"env": {
"DB2_URL": "db2://hostname.inps.it:446/DBNAME",
"DB2_USERNAME": "user",
"DB2_PASSWORD": "password"
}
}
}
}