---
title: "DB24 | Docs - MCP Server"
url: https://db24.ai/docs/mcp-server
description: "The DB24 MCP server lets any MCP-capable assistant read what DB24 knows about your SQL Server environment through read-only tools."
lang: en
---

# MCP Server

Last updated: November 23, 2026

## MCP Server

The Model Context Protocol (MCP) is an open standard that connects AI assistants to other systems. An assistant (the MCP client) talks to an MCP server, which offers a catalogue of tools with descriptions and typed parameters; the assistant picks the tools that answer a question, calls them, and writes its answer from the results. The DB24 MCP server lets any MCP-capable assistant read what DB24 knows about your SQL Server environment through read-only tools: instances, databases, backups, performance, security, alerts, change tracking, availability groups, storage, patching and the AiQ health scores. Everything is answered from the DB24 Datastore — the MCP server never connects to your SQL Server instances.

* * *

## How It Works

The MCP server is a separate Windows service installed by the DB24 installer next to the portal. It reads the same Datastore the portal uses and enforces what the portal configures.

| Component | Role |
| --- | --- |
| MCP server | Windows service `DB24 MCP`, plain HTTP on port `52441` at the path `/mcp`, stateless (every request is authenticated) |
| DB24 Datastore | Source of all data; the server runs read-only queries against the `portal` views |
| Portal | Settings > Organization > MCP: turns the server on, chooses tools and visible instances, issues API keys, shows the log |
| MCP client | Any MCP-capable AI assistant, connecting with a bearer token (the API key) |

The installer does **not** open port 52441 in the firewall. Before clients on other machines connect, publish the endpoint through IIS with a TLS certificate, or open the port deliberately — see Connecting a Client.

* * *

## Access Model

Four layers decide what a request may see. Each layer can only narrow the one before it.

### 1. Server switch

**MCP server enabled** on the General tab turns the server on or off for the whole organisation. When off, every request is rejected regardless of API key.

### 2. Tool switches

The Tools tab has one switch per tool. A disabled tool is hidden from every client, whatever its key allows. Two tools expose principals and permissions and start disabled:

- `get_sql_logins`
- `get_database_users`

Enable them deliberately when an assistant should review access.

### 3. Instance rules

The Instances tab decides which instances MCP clients can see at all. A rule targets one instance or one tag and either includes or excludes the matching instances.

| Precedence | Rule |
| --- | --- |
| 1 | An **instance rule** always wins, in either direction |
| 2 | Among **tag rules**, an exclude beats an include — an instance tagged both ways is hidden |
| 3 | Instances with no matching rule follow **Instances are included in MCP by default** (General tab) |

> Rules compare against instance-level tags only. Tag matching is case-insensitive.

### 4. API key scope

Every key has its own scope: **all tools** or a fixed list, and **all instances**, a fixed list of instances, or every instance carrying one of the selected tags. A key can only narrow what the organisation exposes — an instance hidden by an instance rule stays hidden even if the key names it, and a tool disabled on the Tools tab stays unavailable even if the key includes it.

The one exception is `get_access_info`, which every key can always call. It tells the assistant what the key can reach and why a tool or instance is missing, without naming hidden instances.

* * *

## Portal Settings

All configuration lives under **Settings > Organization > MCP** in the portal and requires the Admin role. Changes to the server switch, tools and instance rules reach the MCP server within 30 seconds; revoking a key takes effect immediately.

| Tab | What it does |
| --- | --- |
| General | Server on/off, whether instances are included by default, example client configuration, TLS guidance |
| Tools | One switch per tool, grouped by family; expand a row to read the exact description the assistant sees |
| Instances | Include and exclude rules per instance or tag, with the effective visibility of every instance and the reason |
| API keys | Create, edit and revoke keys; each key has a name, an expiry (at most 365 days) and its tool and instance scope |
| Requests | Every tool call: key, client, tool, arguments and outcome. Responses are never logged. Rows are kept for 60 days (Data Retention) |

### API keys

- The key is shown **once** when it is created. Only a SHA-256 hash and the first eight characters after the `db24_key_` prefix are stored; a lost key is revoked and replaced.
- Keys expire after 30, 90 (default), 180 or 365 days. Expiry cannot be extended — create a new key instead.
- While you edit a key's scope, the dialog previews which tools and instances it will reach.
- A revoked key is rejected immediately and stays in the list for audit.
- Last used and usage count are updated by the server about once a minute.
* * *

## Connecting a Client

Clients connect over HTTP and send the API key as a bearer token. An administrator enters the **MCP server address** on the General tab once; every key created afterwards comes with ready-to-use options in the key dialog, all with the address and the key already filled in:

| Option | For | Needs on the client |
| --- | --- | --- |
| Bundle (Windows, `.mcpb`) | Assistants that install MCPB files, such as Claude Desktop; double-click and confirm | Nothing (bridge included) |
| VS Code install link | GitHub Copilot in VS Code. The link is copied, not opened, because it contains the key; paste it in a browser or terminal | VS Code |
| JSON configuration | Assistants that read a configuration file and run MCP servers locally (`mcp-remote`) | Node.js |

Until a server address is set, the options use a placeholder. The dialog warns when the address does not end in `/mcp`.

The bundle contains the **DB24 bridge** (`db24-mcp-bridge.exe`), a small self-contained Windows program that reads the assistant's requests on stdin, forwards them to the DB24 MCP server over HTTP with the key, and writes the answers back. It is published by the pipeline into the portal, and the portal builds the bundle in the browser when the key is created, so the key never travels back to the server.

Assistants that connect to HTTP MCP servers directly only need the address and the key. The JSON configuration for `mcp-remote` looks like this (`--allow-http` is only needed for an `http://` address and can be dropped behind TLS):

`{    "mcpServers" :  {      "db24" :  {        "command" :  "npx" ,        "args" :  [          "mcp-remote" ,          "http://<db24-mcp-server>:52441/mcp" ,          "--allow-http" ,          "--header" ,          "Authorization: Bearer <api-key>"        ]      }    }  } `

### Publishing with TLS (recommended)

The service speaks plain HTTP, so the API key would travel unencrypted on the network. The recommended setup is an IIS site on the DB24 server that terminates TLS and forwards to the service on localhost. IIS, URL Rewrite and Application Request Routing are already installed by the DB24 installer.

1. Import a certificate for the host name clients will use into _Local Machine > Personal_.
2. Add a website (for example `DB24 MCP`) with an empty physical folder and an `https` binding on a port of your choice, such as `52443`.
3. Save a `web.config` in the site folder with one rewrite rule: `(.*)` → `http://localhost:52441/{R:1}` (the rule forwards the path, so `/mcp` passes through).
4. Open only the HTTPS port in the firewall and leave 52441 closed.
5. Browse to `https://<host>:52443/mcp`. A JSON answer saying `Unauthorized. Send a DB24 MCP API key ...` with no certificate warning means TLS, IIS and the service all work.
6. Point clients at `https://<host>:52443/mcp`.

The info panel on the General tab has the full step-by-step guide, including troubleshooting.

### Without TLS

Inside a trusted network segment or a test environment, port 52441 can be opened directly on the DB24 server. Restrict the firewall rule to the client addresses where possible.

* * *

## Tools

A tool is one question an AI assistant can ask DB24. Every tool has a name, a description and typed parameters; the assistant reads the descriptions, picks the tools that answer the user's question and writes its answer from the results. All DB24 tools are read-only.

Two things leave DB24 when a tool is used: the **description**, so the assistant knows what the tool does, and the **answer**, the collected data the tool returns. That answer goes to whichever AI service the assistant runs on, so the switches on the Tools tab are the organisation's decision about what it is comfortable exposing. Most tools return operational data and start enabled. The two tools that expose principals and permissions start disabled. `get_heavy_queries` returns query text and `get_change_activity_details` returns captured DDL, which some environments treat as sensitive. The Requests tab shows afterwards which tools were called, by which key and with which arguments.

Tools are grouped by family; the family is also how the Tools tab groups the switches. The Tools tab shows the exact description the assistant sees for each tool.

### Access

| Tool | Returns |
| --- | --- |
| `get_access_info` | What this key can reach: scope, organisation settings, unavailable tools and hidden instance counts. Always available. |

### Instances

| Tool | Returns |
| --- | --- |
| `get_instances` | All SQL Server instances with status, version, AiQ score and tags. The entry point for instance ids |
| `get_instance_details` | Full configuration of one or all instances: host, version, CPU, memory, settings and paths |

### Databases

| Tool | Returns |
| --- | --- |
| `get_databases_summary` | One row per database: state, recovery model, sizes, last good CHECKDB, VLFs and tags |
| `get_database_details` | One row per database file for one instance with growth, options and volume |

### Security

| Tool | Returns | Default |
| --- | --- | --- |
| `get_sql_logins` | SQL Server logins with sysadmin flags, roles and permissions | Off |
| `get_database_users` | Database users with roles and permissions for one instance | Off |

### Connections

| Tool | Returns |
| --- | --- |
| `get_connections_summary` | Which logins connected, from where and how, aggregated per login |
| `get_connections_instance` | Logins that connected to one instance per day with programs and hosts |

### Performance

| Tool | Returns |
| --- | --- |
| `get_performance_summary` | CPU, memory, waits and IO overview per instance or for one instance |
| `get_performance_cpu_usage` | Hourly CPU usage for one instance |
| `get_instance_performance_memory_usage` | Memory metrics over time for one instance |
| `get_performance_waits` | Top wait types per hour for one instance |
| `get_performance_db_file_io` | IO and stalls per database for one instance in time buckets |
| `get_heavy_queries` | Heaviest queries on one instance including query text |
| `get_index_efficiency` | Usage and efficiency rating of non-clustered indexes for one instance |

### Backups

| Tool | Returns |
| --- | --- |
| `get_backup_summary` | Backup health assessment for the environment or one instance |
| `get_backup_instance_history` | Backup runs and errors per database for one instance over a date range |

### Maintenance

| Tool | Returns |
| --- | --- |
| `get_maintenance_summary` | What DB24 maintenance did in a date range: job runs and per-instance aggregates |
| `get_dbcc_status` | Integrity check status per database with days since the last good CHECKDB |

### Alerts

| Tool | Returns |
| --- | --- |
| `get_alerts_environment_summary` | Aggregated DB24 runtime alerts across all instances |
| `get_alerts_instance_summary` | Aggregated DB24 runtime alerts with repeated patterns for one instance |
| `get_alerts_details` | Raw DB24 runtime alert events for one instance |

### Change tracking

| Tool | Returns |
| --- | --- |
| `get_change_activity_environment_summary` | Aggregated schema and login change activity across all instances |
| `get_change_activity_instance_summary` | Aggregated schema and login change activity for one instance |
| `get_change_activity_details` | Raw change events with DDL commands for one instance |

### Availability groups

| Tool | Returns |
| --- | --- |
| `get_ag_summary` | Availability groups with health, replicas and issue counts |
| `get_ag_details` | Replicas, databases, listeners and recent changes for one availability group |

### SQL Agent jobs

| Tool | Returns |
| --- | --- |
| `get_sql_agent_jobs` | SQL Agent jobs and schedules with durations and failure notifications |
| `get_sql_agent_job_run_history` | SQL Agent job run history with failed runs grouped by job and message |

### Storage

| Tool | Returns |
| --- | --- |
| `get_storage_volume_info` | Current disk volume usage against the DB24 free-space threshold |
| `get_storage_history` | Disk space history and growth trend per volume for one instance |

### Lifecycle

| Tool | Returns |
| --- | --- |
| `get_sql_lifecycle_advisory` | SQL Server version support status and end-of-support dates per instance |
| `get_patch_advisory` | Installed and recommended CU/SP per instance and whether it is behind |

### AiQ

| Tool | Returns |
| --- | --- |
| `get_aiq_meta_info` | AiQ categories and parameters with weights and remediation instructions |
| `get_aiq_instances_summary` | AiQ score per instance and main category for the whole environment |
| `get_aiq_instance_details` | AiQ parameter scores for one or more instances |

* * *

## Prompts

Prompts are ready-made workflows the assistant can start from. A prompt is only offered when the key can use the tool it starts with.

| Prompt | Purpose |
| --- | --- |
| `daily_health_check` | Morning check of the whole environment, ending with today's action list |
| `environment_overview` | Inventory for someone new: instances, versions, support and patch status, AiQ scores |
| `what_changed_last_week` | A changelog of the last seven days: schema and login changes, alerts and failed jobs |
| `backup_risk_review` | Databases whose backups or integrity checks put them at risk, with the evidence |
| `capacity_forecast` | Which volumes run out of space and when, and the databases driving the growth |
| `security_posture_review` | Sysadmins, risky settings, unencrypted connections, login changes and over-privileged users, by risk |
| `aiq_improvement_plan` | A prioritised remediation plan for the weakest instances from the AiQ scores |
| `patching_plan` | Instances grouped by patching urgency with the recommended CU or SP |
| `instance_health_report` | A full health report for one instance with a verdict per area |
| `performance_troubleshoot` | Root-cause analysis of a slow instance, from summary to waits to queries and indexes |
| `database_review` | Everything DB24 knows about one database |

* * *

## How Tools Answer

Every tool returns the same envelope so the assistant can rely on its shape:

| Field | Meaning |
| --- | --- |
| `data` | The result. `null` when the request could not be answered (invalid argument, bad range, unknown instance) |
| `toolSpecificInstructions` | What the fields mean, what to look at first, the applied range and any warning |
| `followUps` | Tools worth calling next, with the reason (and any arguments to pass) in plain text |

A few conventions apply everywhere:

**Timestamps are the instance's local time.** DB24 stores collected data in the local time of the runtime that collected it, without a time zone offset. Tools return it unchanged, as `yyyy-MM-ddTHH:mm:ss`, and the assistant is told not to convert it.

**Long ranges are clamped, not rejected.** Each tool has a default window and a maximum (for example 24 hours and 7 days for hourly performance data, 7 and 31 days for connections and job history, 30 and 365 days for storage history). A longer request keeps the most recent part, and the response says so in a warning the assistant must relay. A range whose end is not after its start is rejected.

**Large results are capped.** The alert and change-activity detail tools return at most 100 rows unfiltered and 200 filtered, and say how many rows matched in total, so the assistant narrows with the filters the summary tools provide.

**Hidden instances never appear.** Every repository query is filtered by the request's instance scope, and a response guard scans each result for ids or names of hidden instances before it leaves the server. A hit fails the call and is logged.

* * *

## Logging and Security

| Aspect | Behaviour |
| --- | --- |
| Authentication | API key as bearer token; the key is hashed with SHA-256 and compared in constant time |
| Failed attempts | Logged as `Unauthenticated` at most once per source address per minute, so a scan cannot fill the log |
| Request log | Timestamp, key, client name and version, tool, arguments, instances named, status and duration |
| Responses | Never logged |
| Retention | 60 days, purged by the nightly Data Retention step |
| Data access | Read-only queries against the Datastore; the server has no write path |

Request statuses in the log: `OK`, `Tool error`, `Denied` (tool or instance outside the key's access), `Unauthenticated`, and `Blocked by guard` (the response guard stopped a result).

* * *

## Troubleshooting

**A tool is missing from the assistant's tool list.** Ask the assistant to call `get_access_info`: it lists every unavailable tool with the reason, either disabled on the Tools tab or outside the key's scope.

**An instance cannot be found.** Either it is not registered in DB24, hidden by an instance or tag rule, hidden by the default on the General tab, or outside the key's instance scope. The Instances tab shows the effective visibility and reason for every instance; `get_access_info` shows the counts per reason to the assistant.

**401 Unauthorized.** The key is missing, revoked or expired. Create a new key on the API keys tab.

**503 Service Unavailable.** The MCP server is switched off on the General tab.

**404 Not Found.** The address has a path other than `/mcp`. The server answers with a JSON error naming the correct path; behind IIS, a 404 with the IIS page instead means the `web.config` is missing. The root address still works for clients configured before the `/mcp` path was introduced.

**502 Bad Gateway behind IIS.** The `DB24 MCP` Windows service is not running, or the ARR proxy is disabled.

* * *

## Related Documentation

- DB24 Overview (https://db24.ai/docs/overview) — Platform introduction
- Notifications (https://db24.ai/docs/notifications) — Alert configuration behind the alert tools

Previous Integration: https://db24.ai/docs/integration
Next LDAP Authentication: https://db24.ai/docs/ldap-authentication

## Structured data

```json
{
  "@context": "https://schema.org",
  "@type": "Organization",
  "name": "DB24",
  "url": "https://db24.ai",
  "logo": "https://db24.ai/logo.png",
  "description": "SQL Server on autopilot. DB24 monitors, backs up and documents SQL Server automatically for organisations that run it without a dedicated DBA.",
  "contactPoint": {
    "@type": "ContactPoint",
    "contactType": "sales",
    "email": "sales@db24.ai"
  },
  "sameAs": [
    "https://www.linkedin.com/company/db24"
  ]
}
```