DB24 LogoDB24 Docs

    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.

    ComponentRole
    MCP serverWindows service DB24 MCP, plain HTTP on port 52441 at the path /mcp, stateless (every request is authenticated)
    DB24 DatastoreSource of all data; the server runs read-only queries against the portal views
    PortalSettings > Organization > MCP: turns the server on, chooses tools and visible instances, issues API keys, shows the log
    MCP clientAny 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.

    PrecedenceRule
    1An instance rule always wins, in either direction
    2Among tag rules, an exclude beats an include — an instance tagged both ways is hidden
    3Instances 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.

    TabWhat it does
    GeneralServer on/off, whether instances are included by default, example client configuration, TLS guidance
    ToolsOne switch per tool, grouped by family; expand a row to read the exact description the assistant sees
    InstancesInclude and exclude rules per instance or tag, with the effective visibility of every instance and the reason
    API keysCreate, edit and revoke keys; each key has a name, an expiry (at most 365 days) and its tool and instance scope
    RequestsEvery 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:

    OptionForNeeds on the client
    Bundle (Windows, .mcpb)Assistants that install MCPB files, such as Claude Desktop; double-click and confirmNothing (bridge included)
    VS Code install linkGitHub Copilot in VS Code. The link is copied, not opened, because it contains the key; paste it in a browser or terminalVS Code
    JSON configurationAssistants 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>" ] } } }

    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

    ToolReturns
    get_access_infoWhat this key can reach: scope, organisation settings, unavailable tools and hidden instance counts. Always available.

    Instances

    ToolReturns
    get_instancesAll SQL Server instances with status, version, AiQ score and tags. The entry point for instance ids
    get_instance_detailsFull configuration of one or all instances: host, version, CPU, memory, settings and paths

    Databases

    ToolReturns
    get_databases_summaryOne row per database: state, recovery model, sizes, last good CHECKDB, VLFs and tags
    get_database_detailsOne row per database file for one instance with growth, options and volume

    Security

    ToolReturnsDefault
    get_sql_loginsSQL Server logins with sysadmin flags, roles and permissionsOff
    get_database_usersDatabase users with roles and permissions for one instanceOff

    Connections

    ToolReturns
    get_connections_summaryWhich logins connected, from where and how, aggregated per login
    get_connections_instanceLogins that connected to one instance per day with programs and hosts

    Performance

    ToolReturns
    get_performance_summaryCPU, memory, waits and IO overview per instance or for one instance
    get_performance_cpu_usageHourly CPU usage for one instance
    get_instance_performance_memory_usageMemory metrics over time for one instance
    get_performance_waitsTop wait types per hour for one instance
    get_performance_db_file_ioIO and stalls per database for one instance in time buckets
    get_heavy_queriesHeaviest queries on one instance including query text
    get_index_efficiencyUsage and efficiency rating of non-clustered indexes for one instance

    Backups

    ToolReturns
    get_backup_summaryBackup health assessment for the environment or one instance
    get_backup_instance_historyBackup runs and errors per database for one instance over a date range

    Maintenance

    ToolReturns
    get_maintenance_summaryWhat DB24 maintenance did in a date range: job runs and per-instance aggregates
    get_dbcc_statusIntegrity check status per database with days since the last good CHECKDB

    Alerts

    ToolReturns
    get_alerts_environment_summaryAggregated DB24 runtime alerts across all instances
    get_alerts_instance_summaryAggregated DB24 runtime alerts with repeated patterns for one instance
    get_alerts_detailsRaw DB24 runtime alert events for one instance

    Change tracking

    ToolReturns
    get_change_activity_environment_summaryAggregated schema and login change activity across all instances
    get_change_activity_instance_summaryAggregated schema and login change activity for one instance
    get_change_activity_detailsRaw change events with DDL commands for one instance

    Availability groups

    ToolReturns
    get_ag_summaryAvailability groups with health, replicas and issue counts
    get_ag_detailsReplicas, databases, listeners and recent changes for one availability group

    SQL Agent jobs

    ToolReturns
    get_sql_agent_jobsSQL Agent jobs and schedules with durations and failure notifications
    get_sql_agent_job_run_historySQL Agent job run history with failed runs grouped by job and message

    Storage

    ToolReturns
    get_storage_volume_infoCurrent disk volume usage against the DB24 free-space threshold
    get_storage_historyDisk space history and growth trend per volume for one instance

    Lifecycle

    ToolReturns
    get_sql_lifecycle_advisorySQL Server version support status and end-of-support dates per instance
    get_patch_advisoryInstalled and recommended CU/SP per instance and whether it is behind

    AiQ

    ToolReturns
    get_aiq_meta_infoAiQ categories and parameters with weights and remediation instructions
    get_aiq_instances_summaryAiQ score per instance and main category for the whole environment
    get_aiq_instance_detailsAiQ 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.

    PromptPurpose
    daily_health_checkMorning check of the whole environment, ending with today's action list
    environment_overviewInventory for someone new: instances, versions, support and patch status, AiQ scores
    what_changed_last_weekA changelog of the last seven days: schema and login changes, alerts and failed jobs
    backup_risk_reviewDatabases whose backups or integrity checks put them at risk, with the evidence
    capacity_forecastWhich volumes run out of space and when, and the databases driving the growth
    security_posture_reviewSysadmins, risky settings, unencrypted connections, login changes and over-privileged users, by risk
    aiq_improvement_planA prioritised remediation plan for the weakest instances from the AiQ scores
    patching_planInstances grouped by patching urgency with the recommended CU or SP
    instance_health_reportA full health report for one instance with a verdict per area
    performance_troubleshootRoot-cause analysis of a slow instance, from summary to waits to queries and indexes
    database_reviewEverything DB24 knows about one database

    How Tools Answer

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

    FieldMeaning
    dataThe result. null when the request could not be answered (invalid argument, bad range, unknown instance)
    toolSpecificInstructionsWhat the fields mean, what to look at first, the applied range and any warning
    followUpsTools 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

    AspectBehaviour
    AuthenticationAPI key as bearer token; the key is hashed with SHA-256 and compared in constant time
    Failed attemptsLogged as Unauthenticated at most once per source address per minute, so a scan cannot fill the log
    Request logTimestamp, key, client name and version, tool, arguments, instances named, status and duration
    ResponsesNever logged
    Retention60 days, purged by the nightly Data Retention step
    Data accessRead-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.