home / mcp / ibm-db2 mcp server

IBM-DB2 MCP Server

This read-only MCP Server allows you to connect to IBM DB2 data from Claude Desktop through CData JDBC Drivers. For full CRUD support, check out our MCP Server for IBM DB2 (https://www.cdata.com/drivers/db2/download/mcp).

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "cdatasoftware-ibm-db2-mcp-server-by-cdata": {
      "command": "java",
      "args": [
        "-jar",
        "/PATH/TO/CDataMCP-jar-with-dependencies.jar",
        "/PATH/TO/ibm-db2.prp"
      ]
    }
  }
}

This MCP server provides a read-only bridge to IBM DB2 data, exposing live information to large-language models without requiring SQL. You install a lightweight MCP service that talks to the CData JDBC Driver for IBM DB2 and exposes data through a simple MCP interface for querying and reading data in natural language.

How to use

You run the MCP server on the same machine as your client or expose it via a compatible MCP client. Once the server is up, your AI assistant can read live IBM DB2 data by asking questions or requesting data views. Typical usage includes asking for counts, aggregations, or lists from tables, such as the number of open issues in a project or the latest records from a table, without writing SQL.

How to install

# Prerequisites
# - Java JDK 8+ (for running the MCP server)
# - Maven (for building the MCP server)

# 1) Clone the project
git clone https://github.com/cdatasoftware/ibm-db2-mcp-server-by-cdata.git
cd ibm-db2-mcp-server-by-cdata

# 2) Build the server
mvn clean install

# This creates the JAR file: CDataMCP-jar-with-dependencies.jar
```

Next, you install and license the CData JDBC Driver for IBM DB2, set up your connection, and create a property file for the JDBC connection. The process involves running the driver launcher to license, configuring the connection string, and saving a .prp file with JDBC details. The exact command flow for your environment is:

```bash
# License the driver (example; adapt to your installation path)
java -jar cdata.jdbc.db2.jar --license
```

Then you configure the connection and save a properties file similar to the following, replacing paths and values with your setup:

```env
Prefix=db2
ServerName=CDataDB2
ServerVersion=1.0
DriverPath=PATH\TO\cdata.jdbc.db2.jar
DriverClass=cdata.jdbc.db2.DB2Driver
JdbcUrl=jdbc:db2:InitiateOAuth=GETANDREFRESH;
Tables=
```

Finally, you prepare the MCP runtime entry. The server is started by invoking the MCP JAR with your .prp file:

```bash
java -jar /PATH/TO/CDataMCP-jar-with-dependencies.jar /PATH/TO/ibm-db2.prp
```

This runs the MCP server in stdio mode, which is designed to work with an MCP client on the same machine.
```]} ,{

Additional sections

Configuration for Claude Desktop or other MCP clients is provided by creating an MCP config entry that points to the Java runtime and the MCP JAR with your JDBC property file. The example below demonstrates how you wire the server into a client configuration. You may need to adjust paths to your environment.

{
  "mcpServers": {
    "ibmdb2_mcp": {
      "command": "java",
      "args": [
        "-jar",
        "/PATH/TO/CDataMCP-jar-with-dependencies.jar",
        "/PATH/TO/ibm-db2.prp"
      ]
    }
  }
}

Troubleshooting

If you do not see the MCP server in your client, ensure you have fully exited and restarted the client after adding the new server entry. Verify that your JDBC connection string in the .prp file points to a reachable IBM DB2 instance and that the driver is licensed. If you encounter connection failures, re-test the connection string using the JDBC Driver’s utility and re-copy the resulting string into your .prp file.

Notes

This MCP server is read-only by design. It is intended to allow querying live IBM DB2 data without direct SQL input. For full read/write/update/delete capabilities and broader action support, consider the full MCP server variant from the same family.

Licensing

The MCP server uses the MIT License. You are free to use, modify, and distribute the software in accordance with the MIT terms.

Available tools

ibm_db2_get_tables

Retrieves a list of tables available in the IBM DB2 data source. Output is in CSV format with a header row.

ibm_db2_get_columns

Retrieves a list of columns for a specified table. Output is in CSV format with a header row.

ibm_db2_run_query

Executes a SQL SELECT query against the IBM DB2 data source and returns results.