db2-mcp-server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@db2-mcp-serverlist tables in the HR schema"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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.
Related MCP server: mcp-server-db2i
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.
Dynamic Prompt Loading: Load custom prompts from JSON configuration files for flexible query assistance.
Built-in Prompts: Pre-configured prompts for DB2 query help and schema analysis.
Requirements
Python 3.12
FastMCP (latest stable version)
IBM DB2 Python driver (
ibm_db)Pydantic
Setup Instructions
Clone the Repository
git clone <repository-url> cd db2-mcp-serverSet Up Virtual Environment
uv v0.6.x source uv/bin/activateInstall Dependencies
pip install -r requirements.txtRun the Server
python src/db2_mcp_server/core.py
Dynamic Prompts
The server supports dynamic prompt loading from JSON configuration files. Set the PROMPTS_FILE environment variable to specify a custom prompts configuration file.
Example Usage
export PROMPTS_FILE=/path/to/your/prompts_config.json
python src/db2_mcp_server/core.pyConfiguration Format
See examples/prompts_config.json for a complete example and docs/DYNAMIC_PROMPTS.md for detailed documentation.
Testing
Use
pytest(version ≥ 7.0.0) for running tests.Current test coverage: 92.98% (exceeding the 80% requirement).
Comprehensive test suite includes:
Core functionality tests (
test_core.py)Database tools tests (
test_list_tables.py,test_metadata_retrieval.py)Caching mechanism tests (
test_cache.py)Logging configuration tests (
test_logger.py)Dynamic prompt loading tests (
test_dynamic_loader.py,test_integration_dynamic_prompts.py)
Run tests with:
pytest --cov=src/db2_mcp_server --cov-report=html tests/For verbose output:
pytest --cov=src/db2_mcp_server --cov-report=term-missing -v
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.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables safe exploration and querying of multiple databases (PostgreSQL, MySQL, SQLite, DB2) with read-only defaults, connection pooling, and parameterized queries for SQL injection prevention.1MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to query and inspect IBM DB2 for i databases using read-only SQL commands and schema inspection tools. It provides secure access to table metadata, views, and indexes via the JT400 JDBC driver.2420MIT
- AlicenseNot gradedqualityCmaintenanceEnables development support for AS400/IBM i systems by providing read-only access to metadata, source code, and program dependencies via ODBC. It supports CL, RPG, and COBOL environments, allowing users to retrieve library, table, and system information.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables read-only SQL query execution and database schema information retrieval for PostgreSQL databases.10MIT
Related MCP Connectors
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Explore your Messages SQLite database to browse tables and inspect schemas with ease. Run flexible…
Read-only access to your VortexIQ store data: audits, KPIs, alerts, Brand DNA, reports, Ask VIQ.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/huangjien/db2-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server