db2-mcp-server

by huangjien

168 downloads
Not rated
GitHub

About

db2-mcp-server is a Python-based server that uses the Model Context Protocol (MCP) to interact with IBM DB2 databases. It provides tools for listing tables and retrieving table metadata, and is intended for read-only database exploration.

Details

Author
huangjien
Downloads
168
Categories
Other

- List tables from the connected DB2 database.
- Retrieve metadata for a specific table (column details, data types).
- Read-only access – prohibits INSERT, UPDATE, DELETE operations.
- Structured JSON logging (sensitive data excluded).
- Requires Python 3.12, FastMCP, ibm_db, and Pydantic.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name db2-mcp-server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Clone the repository, set up a virtual environment with uv, install dependencies with pip install -r requirements.txt, then run the server with python src/db2_mcp_server/core.py. Tests can be executed using pytest --strict-markers --cov.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "db2-mcp-server": {
            "db2-mcp-server": {
                "command": "uv",
                "args": [
                    "v0.6.x"
                ]
            }
        }
    }
}

McpServers

{
    "db2-mcp-server": {
        "command": "uv",
        "args": [
            "v0.6.x"
        ]
    }
}

db2-mcp-server

Overview

The db2-mcp-server is a Python-based server utilizing the MCP framework to interact with IBM DB2 databases. It provides tools for listing tables and retrieving table metadata.

Features

- List Tables: Retrieve a list of tables from the connected DB2 database. - Get Table Metadata: Fetch metadata for a specific table, including column details and data types.

Requirements

- Python 3.12 - FastMCP (latest stable version) - IBM DB2 Python driver (ibm_db) - Pydantic

Setup Instructions

1. Clone the Repository
   git clone <repository-url>
   cd db2-mcp-server
   

2. Set Up Virtual Environment

   uv v0.6.x
source uv/bin/activate

3. Install Dependencies

   pip install -r requirements.txt

4. Run the Server

   python src/db2_mcp_server/core.py

Testing

- Use pytest (version ≥ 7.0.0) for running tests. - Ensure code coverage is ≥ 90%. - Run tests with:
  pytest --strict-markers --cov
  

Security and API Restrictions

- The server is read-only, prohibiting SQL INSERT, UPDATE, or DELETE operations. - Uses a database user with only SELECT privileges.

Logging

- Errors are logged with structured logs in JSON format, excluding sensitive data.

Contribution

- Contributions are welcome. Please follow the project's coding standards and testing guidelines.
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.