Introducing Db2 Genius MCP Server -- a standards-based bridge that lets any MCP-compatible AI client query, monitor, and tune your Db2 database in plain language.
Connecting an AI to your database shouldn’t require a PhD in plumbing
You’ve seen the demos: ask a question in plain English, get a SQL result. In practice the pipeline to get there is anything but plain. Someone has to write a bespoke integration layer, wire up credentials in a way that doesn’t leak them into a prompt, and copy-paste the right schema fragments so the model isn’t hallucinating column names.
And then you do it all again every time the database or the AI client changes.
For IBM Db2 shops this friction is especially sharp. Db2’s rich monitoring infrastructure — active session history, buffer pool metrics, wait-time breakdowns, workload manager queues — sits entirely outside the reach of every AI assistant, unless you build the bridge yourself.
There is now a better way.
A quick word on MCP
Model Context Protocol (MCP) is an open standard, originally developed by Anthropic and now backed by a growing ecosystem. It defines a consistent interface for connecting AI assistants to external tools, data sources, and services. Think of it as USB-C for AI integrations: one standard plug, any device on either side.
An MCP server exposes a set of named tools and resources. Any MCP-compatible client — Claude Desktop, IBM Bob, VS Code Copilot, custom agents — can discover and call those tools, and the client never needs to know how your server works behind the interface. That decoupling is exactly what removes the re-wiring tax from the last section.
If you’re already familiar with MCP, skip ahead. If not, the official site is the best starting point.
What we built: Db2 Genius MCP Server
With the IBM Db2 Genius Hub 1.1.3 release, we are introducing the Db2 Genius MCP Server — an MCP server that connects any MCP-compatible AI assistant directly to IBM Db2 databases through IBM Db2 Genius Hub. It exposes 30+ specialised tools covering query execution, schema introspection, performance monitoring, locking analysis, workload management, health checks, and AI-assisted query tuning.
What’s now possible that wasn’t before:
- A DBA can open an AI assistant and ask,
“Which queries are currently blocked and by whom?” to investigate locking and concurrency issues in seconds.
- A developer can ask,
“Give me the explain plan for this query and suggest improvements” and get grounded tuning guidance without manually jumping between tools, plans, and monitoring views.
What the server actually exposes
Every tool is a first-class MCP tool with a typed schema, validation, and structured output. Here’s the full capability map:
- Query Execution: Run read-only SQL against your database in plain language — no client-side SQL required
- Query Analysis & Tuning: Retrieve execution plans and get AI-powered optimisation recommendations for slow queries
- Performance Monitoring: End-to-end time-series analysis of CPU, memory, I/O, response time, and query throughput
- Schema & Metadata: Live schema introspection — tables, views, instance configuration, buffer pool statistics — without sharing credentials with the AI client
- Locking & Concurrency: Identify active locks and blocking sessions; surface deadlock patterns before they become incidents
- Workload Management: Inspect WLM queue state and analyse queuing patterns to understand workload contention
- Storage Management: Monitor tablespace utilisation and flag capacity issues early
- Health & Diagnostics: Comprehensive health checks including HADR status, recent change tracking, and full database diagnostics
- Similarity Search: Find historically similar queries using vector embeddings — useful for diagnosing recurring patterns
- Tool Discovery: Search across the full tool catalogue using BM25 ranking or regex, so agents can self-route to the right capability
Security first — because it’s a database
Any time you put an AI assistant near a production database, the security story is what earns trust. Here’s how Db2 Genius MCP Server handles it:
1. Session isolation and server-side credential handling
- Each user authenticates independently.
- Sessions are isolated with a configurable timeout (default 4 hours).
-
Database credentials are managed server-side in the connection pool — never exposed in config files or environment variables visible to the AI client.
2. Credentials never enter the prompt
- The server authenticates against Genius Hub using a JWT token passed as an HTTP header — it never touches your AI model’s context window.
- Database passwords are kept in the server’s session store, not forwarded to the client or logged.
3. Read-only query enforcement
- The SQL execution tool accepts only
Read-Only statements. Write operations are not exposed — they require separate, explicitly opted-in tooling.
4. Parameterised queries — no injection surface
- Every query the server constructs uses parameterised SQL. User-supplied values (table names, date ranges, filter lists) are never interpolated directly into query strings. This is enforced at the query-construction layer for all 30+ tools, not just the SQL execution tool.
5. TLS in transit
- The HTTP transport has TLS enabled by default. A self-signed certificate is auto-generated on first run if no cert is provided, so you get encryption immediately without extra setup.
6. Error masking in production
- An optional masking flag strips internal stack traces and query fragments from error responses returned to the AI client, preventing information leakage through error messages.
7. RBAC-aware
- The server does not bypass Db2’s own Role-Based Access Control. Queries run under the authenticated user’s Db2 permissions. If a user doesn’t have ` on a table, the server surfaces the Db2 error — it never escalates privilege.
How it works
The server sits between your AI client and IBM Db2, acting as a translation layer from natural-language tool calls into authenticated API requests and parameterised database queries. It has two outbound connection paths depending on the tool called.
Performance and monitoring tools route through Genius Hub’s REST APIs. Schema, SQL, and health tools connect directly to Db2 via the `ibm_db` driver.
The MCP Server is installed alongside Genius Hub. This co-location means monitoring and profile requests to Genius Hub stay on the same host as the MCP layer rather than traversing an additional network hop, while Db2 credentials also do not need to cross an external network boundary to reach the MCP server. The AI client communicates over HTTPS and supplies a Genius Hub JWT in a request header — the server handles all downstream authentication from there.
Internally, every tool call passes through the same pipeline: schema validation → input sanitisation → parameterised query construction → execution → structured response formatting. The consistent pipeline means uniform error handling, predictable output shape, and a single place to enforce security controls across all 30+ tools.
Quickstart with IBM Bob
IBM Bob is the recommended client for getting started. The setup takes three steps.
Step 1 — Get a Genius Hub JWT token
Authenticate against your Genius Hub instance to obtain a short-lived JWT. Use the same username and password that you use to log in to Genius Hub.
If you are calling Genius Hub remotely over HTTPS, run:
curl -X POST 'https://<genius-hub-hostname>:11101/dbapi/v4/auth/tokens' -H 'Content-Type: application/json' -d '{"userid": "your-genius-hub-username", "password": "your-corresponding-password"}' --cacert <path-to-genius-hub-ca-cert.pem>
If you are running this command directly on the Genius Hub host, you can use HTTP:
curl -X POST 'http://<genius-hub-hostname>:11100/dbapi/v4/auth/tokens' -H 'Content-Type: application/json' -d '{"userid": "your-genius-hub-username", "password": "your-corresponding-password"}
The response includes a token field and an expiresIn value (in seconds) indicating how long the token is valid. Genius Hub JWT tokens expire after a set period — when yours expires, the MCP server will return an authentication error on the next request. At that point, re-run the curl command above to obtain a fresh token and update the `X-Genius-Hub-Token` header value in your .bob/mcp.json config.
If your environment supports other Genius Hub authentication mechanisms such as token-based flows, use the method supported by your deployment to obtain the JWT that the MCP server expects in the request header.
Step 2 — Add the server to IBM Bob’s MCP config
Open IBM Bob → Settings → MCP → Open Project MCPs, then add the following to .bob/mcp.json:
"json
{
"mcpServers": {
"db2-genius-mcp": {
"type": "streamable-http",
"url": "https://your-server-host:8000/mcp",
"headers": {
"X-Genius-Hub-Hostname": "your-genius-hub-hostname",
"X-Genius-Hub-Port": "11100",
"X-Genius-Hub-Protocol": "https",
"X-Genius-Hub-Token": "<token-from-step-1>"
},
"disabled": false
}
}
}
The server URL points to the running MCP Server instance. All Db2 credentials stay server-side — the only secret you pass here is the JWT token. You can learn more about IBM Bob at https://bob.ibm.com/
Step 3 — Connect and start asking
Switch IBM Bob to Advanced Mode, then use the `connect_to_profile` tool once to establish the session. After that, use plain language:
- “Show me CPU utilisation trends for PRODDB over the last hour.”
- “Which queries are currently blocked and by whom?”
- “Give me the explain plan for this query and suggest improvements.”
What’s next
The server ships today with the monitoring and analysis capabilities described above. Here’s what’s coming:
July 2026
- Text-to-SQL (natural language → query)
- Query Spilling Analysis — identify when queries spill beyond memory into temporary storage, why that matters for latency and resource contention, and what actions to take to reduce the performance impact.
- RUNSTATS recommendations — understand when stale or missing statistics are hurting optimizer decisions, why refreshed statistics matter for query performance, and what updates will help the AI query optimizer and Db2 choose more efficient access plans.
- Agentic autonomous operations
Later
- Redis-backed distributed sessions
- Write-capable tools (opt-in)
- Broader IBM data platform coverage
- Additional MCP client guides
If something is missing that matters to your Db2 workflow, reach out — that’s the fastest path to the backlog.
About the Authors
Krishna Guntuka is a Lead Software Engineer with 9+ years of experience across various Db2 products, currently leading Agentic AI development for the Db2 Database Assistant — building intelligent autonomous agents using Python, LangChain, LangGraph, RAG pipelines, and LLMs — with a focus on making Db2 products smarter, faster, and more efficient.
Rahul Gadamsetty is a Software Developer in the Db2 Agentic AI team. His work primarily focuses on Agentic AI technologies, with an emphasis on MCP server development, Vertex AI integration, security guardrails, and token optimization for enterprise AI applications. He contributes to the design and development of intelligent, scalable, and secure AI driven solutions within the Db2 Agentic AI and Genius hub MCP server. He holds a bachelor’s degree from National Institute of Technology Calicut. He can be reached at Rahul.Gadamsetty@ibm.com
Yamen Mohieddin is a Software Developer on the IBM Db2 Agentic AI team. His work focuses on Agentic AI and MCP server development, with a focus on AI tooling. He specializes in the design and development of secure, intelligent, and effective AI solutions for the Genius Hub MCP server and Assistant.
Suvarsha Akkireddy is a Software Engineer on the Db2 Agentic AI team at IBM. Her work focuses on Agentic AI development, RAG pipelines, and MCP server development, with an emphasis on building intelligent, data-driven AI solutions.