npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@atom8n/mcp-mssql

v1.0.0

Published

An MCP server for executing queries against Microsoft SQL Server

Readme

MCP Mssql Server

An MCP server that exposes a single execute_sql tool for running parameterless SQL statements against Microsoft SQL Server using the native msnodesqlv8 driver. It is intended for MCP-compatible clients that need direct database access over stdio without exposing credentials in logs.

Features

  • SQL Server Native Driver: Uses msnodesqlv8 and ensures an explicit driver prefix on every connection string.
  • Secure Logging: Masks password fields when echoing the effective connection string to stderr.
  • Flexible Connection Sources: Pulls the connection string from MSSQL_CONNECTION_STRING or an override supplied with each request.
  • Structured Results: Returns rowsAffected counts and all recordsets from the query for easy downstream parsing.
  • Stdio Transport: Ships as an MCP stdio server so it can be dropped into any MCP client configuration.

Installation

npm install @atom8n/mcp-mssql

MCP Configuration

Add the following configuration to your MCP client:

{
  "mcp-mssql": {
    "command": "npx",
    "args": [
      "@atom8n/mcp-mssql"
    ]
  }
}

Available Tools

execute_sql

Execute a SQL statement against Microsoft SQL Server.

Parameters:

  • query (required): T-SQL command text to execute.
  • connectionString (optional): Overrides the MSSQL_CONNECTION_STRING environment variable for this call.

The tool automatically injects Driver={SQL Server Native Client 11.0} when the provided connection string omits a driver segment, so both DSN-style and bare connection strings work out of the box.

Usage Examples

Run a query with the default connection string

{
  "tool": "execute_sql",
  "arguments": {
    "query": "SELECT TOP (5) name FROM sys.databases ORDER BY name"
  }
}

Override the connection string per call

{
  "tool": "execute_sql",
  "arguments": {
    "query": "EXEC dbo.RefreshMaterializedView @name = 'daily_snapshot'",
    "connectionString": "Server=sql.internal;Database=Ops;Trusted_Connection=yes;"
  }
}

Response Format

Requests return JSON text via MCP content with the following shape:

{
  "rowsAffected": [123],
  "recordsets": [
    [
      { "name": "master" },
      { "name": "model" }
    ]
  ]
}

Development

Prerequisites

  • Node.js 18+
  • TypeScript 5.6+
  • npm

Setup

# Clone the repository
git clone <repository-url>
cd mcp-mssql

# Install dependencies
npm install

# Build the project
npm run prepare

Project Structure

├── src/
│   ├── index.mts          # MCP server implementation
│   └── execute_sql.test.mts # Ad-hoc SQL runner for local verification
├── lib/
│   ├── index.mjs          # Compiled JavaScript
│   ├── index.mjs.map      # Source map
│   └── index.d.mts        # TypeScript declarations
├── package.json           # Package configuration
├── tsconfig.json          # TypeScript configuration
└── eslint.config.mjs      # ESLint configuration

Build Process

The project uses TypeScript with the following build configuration:

  • Target: ES2015
  • Module: CommonJS
  • Output: lib/ directory
  • Source Maps: Enabled
  • Declarations: Generated

Scripts

  • prepare: Compiles TypeScript and makes the binary executable
  • inspect: Launches the MCP inspector against the compiled server
  • test:sql: Runs src/execute_sql.test.mts with ts-node for manual checks

Dependencies

Runtime Dependencies

  • @modelcontextprotocol/sdk: MCP server framework
  • dotenv: Environment variable loader
  • msnodesqlv8: Native SQL Server driver
  • rimraf: File system utilities
  • spawn-rx: Process spawning utilities

Development Dependencies

  • @types/node: Node.js type definitions
  • shx: Shell utilities for cross-platform compatibility
  • ts-node: TypeScript execution
  • typescript: TypeScript compiler

License

MIT License - see COPYING file for details.

Contributing

Please read CODE_OF_CONDUCT.md for our code of conduct and contribution guidelines.

Version

Current version: 1.0.0

Support

For issues and feature requests, please use the project's issue tracker.