MS

MSSQL MCP Server SQLite Adaptation Module

Adapt your MCP server to MSSQL with daobataotie's module that modifies the official SQLite MCP for smooth MSSQL compatibility.

Quick Install
npx -y @daobataotie/mssql-mcp

Overview

The MSSQL MCP Server SQLite Adaptation Module adapts the official SQLite-based Model Context Protocol (MCP) server to work with Microsoft SQL Server (MSSQL). Instead of rewriting the entire MCP server, this module provides the minimal changes needed to replace SQLite-specific logic with MSSQL-compatible queries, connection handling, and schema expectations. That makes it easier to run an MCP server in environments that require enterprise-grade database features or where existing MSSQL infrastructure is mandated.

This adaptation is useful when you want the MCP protocol and tooling to remain the same but need a backend that supports SQL Server features such as integrated authentication, larger datasets, and existing backup/replication procedures. The module is distributed as a lightweight patch/adapter that you apply to the official SQLite MCP server codebase or run alongside it as a replacement persistence layer.

Features

  • Converts SQLite persistence layer to use Microsoft SQL Server
  • Minimal invasive changes so the official MCP server workflow is preserved
  • Configuration examples for environment variables and connection strings
  • Sample Docker Compose setup for local MSSQL + MCP development
  • Basic migration guidance for translating SQLite schema expectations to MSSQL
  • Includes helper SQL snippets and table definitions for quick setup

Installation / Configuration

The module is distributed on GitHub. Typical installation steps assume you have the official MCP server source and Node.js environment (adjust for your runtime as needed).

  1. Clone the adapter and the official MCP server:
# clone the adapter
git clone https://github.com/daobataotie/mssql-mcp.git

# clone the official MCP server (replace with actual upstream repo)
git clone https://github.com/your-org/mcp-server.git
  1. Install dependencies (example for Node.js; install the MSSQL driver):
cd mssql-mcp
npm install
# ensure the mssql driver is available to the MCP server
cd ../mcp-server
npm install mssql
  1. Replace or register the SQLite persistence module with the MSSQL adapter:
  • Copy the adapter files into the MCP server module directory, or
  • Set your MCP server to require the adapter module instead of the SQLite module.

Example (illustrative):

// inside mcp-server index.js or persistence loader
// const sqlitePersistence = require('./persistence/sqlite')
const mssqlPersistence = require('../mssql-mcp/persistence/mssql')
  1. Configure connection via environment variables or config file. Example environment variables:
MCP_DB_TYPE=mssql
MCP_DB_HOST=sqlserver.example.com
MCP_DB_PORT=1433
MCP_DB_USER=appuser
MCP_DB_PASSWORD=ChangeMe123
MCP_DB_DATABASE=mcpdb
MCP_DB_TRUST_SERVER_CERT=true

Example JSON config:

{
  "db": {
    "type": "mssql",
    "server": "sqlserver.example.com",
    "port": 1433,
    "user": "appuser",
    "password": "ChangeMe123",
    "database": "mcpdb",
    "options": { "encrypt": true, "trustServerCertificate": true }
  }
}
  1. Start the MCP server as usual:
node index.js

Available Resources

  • GitHub repository (module source): https://github.com/daobataotie/mssql-mcp
  • Official MCP server repository (replace with the upstream repo you use)
  • Microsoft SQL Server Docker image for local testing: mcr.microsoft.com/mssql/server
  • Node.js MSSQL driver documentation: https://www.npmjs.com/package/mssql

Table: Key config fields

KeyDescription
serverMSSQL host name or IP
portTCP port (default 1433)
userDatabase user name
passwordUser password
databaseDatabase name for MCP data
options.encryptEnable TLS/SSL (boolean)
options.trustServerCertificateTrust server cert (boolean for local use)

Use Cases

  • Migrating MCP deployments from SQLite to an enterprise SQL Server

    • Example: A development team running MCP on SQLite wants to move to SQL Server for production to leverage centralized backups and monitoring. Use this adapter to swap persistence layers without changing MCP APIs.
  • Integrating MCP with corporate authentication and auditing

    • Example: A company requires MCP to log actions into an existing MSSQL instance where auditing triggers and retention policies are already configured.
  • Scaling MCP for larger workloads

    • Example: An application outgrows file-based SQLite storage. Replacing persistence with MSSQL provides better concurrency and larger storage capacity.
  • Local development with realistic production-like DB

    • Example: Use Docker Compose to spin up SQL Server and the adapted MCP server locally to reproduce production issues that only appear with MSSQL.

Concrete example: Docker Compose snippet for local development

version: '3.8'
services:
  sqlserver:
    image: mcr.microsoft.com/mssql/server:2019-latest
    environment:
      SA_PASSWORD: "Your_strong!Passw0rd"
      ACCEPT_EULA: "Y"
    ports:
      - "1433:1433"
  mcp-server:
    build: ./mcp-server
    environment:
      MCP_DB_TYPE: mssql
      MCP_DB_HOST: sqlserver
      MCP_DB_USER: sa
      MCP_DB_PASSWORD: "Your_strong!Passw0rd"
      MCP_DB_DATABASE: mcpdb
    depends_on:
      - sqlserver

Notes and best practices

  • Ensure schema compatibility: translate any SQLite-specific types or PRAGMA assumptions to proper MSSQL equivalents.
  • Use secure credential management (secrets manager, not plaintext env vars) in production.
  • Run schema migrations in a controlled way; the adapter may include SQL scripts to create required tables—review and adapt them to your environment.

For more details and the latest instructions, see the project repository: https://github.com/daobataotie/mssql-mcp