Skip to main content
Glama
harryvaldez

MCP SQL Server

by harryvaldez

MCP SQL Server

Remote FastMCP server for dual SQL Server 2019 instances with strong read-only controls, rate limiting, and diagnostics.

What This Repository Provides

  • FastMCP + FastAPI service exposing SQL tools over HTTP at /mcp

  • Dual-instance SQL Server 2019 support (primary and secondary)

  • Read-only SQL policy controls with denylist (13 patterns: DDL, DML, DCL, system procedures) and allowlist config

  • Redis or local rate limiting with per-actor and global limits

  • Security-oriented output handling (sensitive field redaction)

  • Diagnostics endpoints for runtime posture and tool usage

  • Docker runtime and compose files for local and remote operation

Related MCP server: mcp-sqlserver-readonly

Important Documentation

Repository Structure

  • src: service runtime, tool registration, middleware, diagnostics

  • config: instance config, policy, and rate-limit settings

  • policy: SQL allowlist and denylist definitions

  • docker: Dockerfile and compose files

  • tests: unit tests

  • testing: integration and operational test harnesses

  • docs: tool catalog, runbooks, and run instructions

  • docs/runbooks/scaling-strategy.md: runbook for scaling and load-validation operations

  • docs/runbooks/security-maintenance.md: runbook for security posture checks and maintenance

  • docs/access-levels-and-controlled-write.md: access model and controlled-write enforcement reference

Quick Start (Local)

  1. Create and activate a Python 3.11+ virtual environment.

  2. Install dependencies:

Windows (PowerShell):

pip install -e .[dev]

Linux/macOS:

pip install -e '.[dev]'
  1. Copy environment and config templates:

Windows (PowerShell):

Copy-Item .env.example .env

Linux/macOS:

cp .env.example .env
  1. Configure instances in config/instances.yaml (this repository already includes it; no instances.yaml.example file is provided). For parity with the .env.example -> .env pattern above, use the existing file as your local runtime file and use config/instances.runtime.example.yaml as the format/key reference.

  2. Run the service:

python -m src.server
  1. Validate endpoints:

Primary rollout verification checks:

  • /diagnostics/health: confirms service and instance connectivity.

  • /diagnostics/security: confirms auth mode, required scope count, group-authorization posture, and registered tool inventory.

  • /diagnostics/pool: confirms per-instance SQL pool sizing and reuse counters.

Docker Runtime

Use the runtime compose flow documented in docs/run-mcp-server-with-docker.md.

Controlled-write policy is enforced from config/runtime-policy.yaml. The file policy/sql-allowlist.yaml is a review/reference mirror and is not loaded as a runtime policy source.

docker compose -f docker/docker-compose.runtime.yml up -d

Operational Runbooks

Testing

Run unit tests:

pytest -q

Current validation snapshot:

Security Notes

  • Do not commit real secrets.

  • Keep .env local only.

  • Prefer least-privilege SQL credentials.

  • See SECURITY.md for reporting and hardening guidance.

Contributing

See CONTRIBUTING.md for branch, PR, and test expectations.

Release and CI

  • CI runs on pull requests and pushes to master/main.

  • Release tags follow v* (example: v1.2).

  • Latest release notes: docs/release-notes-v1.4.0.md

CMMI-Oriented Platform Integration

This repository includes GitHub-native process controls aligned to CMMI implementation patterns:

  • Requirements management: requirement issue template and PR traceability sections

  • Configuration management: branch protection, CODEOWNERS, signed commits, and protected release tags

  • Verification and validation: CI checks, PR gates, and traceability check workflow

  • Measurement and analysis: scheduled traceability matrix generation

  • Audit trail: issue/PR history, commit history, and workflow logs retained in GitHub

Artifacts:

  • .github/ISSUE_TEMPLATE/requirement.yml

  • .github/workflows/traceability-check.yml

  • .github/workflows/traceability-matrix.yml

  • docs/traceability-matrix.md

License

Licensed under the MIT License. See LICENSE.

A
license - permissive license
-
quality - not tested
-
maintenance - not tested

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/harryvaldez/mcp-sql-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server