This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
mssql-mcp-server is the Admin-tier package of the SQL Server MCP suite. It is a thin wrapper (~12 lines) that calls startMcpServer({ tier: "admin" }) from mssql-mcp-core. All tools, configuration, routing, and audit logic live in the core library.
The SQL Server MCP suite uses a shared-core architecture for enterprise governance:
| Repo | npm Package | Role |
|---|---|---|
mssql-mcp-core |
@connorbritain/mssql-mcp-core |
Shared library — all tools, EnvironmentManager, AuditLogger, SecretResolver, IntentRouter, wrapToolRun, createMcpServer, toolsets |
mssql-mcp-reader |
@connorbritain/mssql-mcp-reader |
Thin wrapper — startMcpServer({ tier: "reader" }) |
mssql-mcp-writer |
@connorbritain/mssql-mcp-writer |
Thin wrapper — startMcpServer({ tier: "writer" }) |
mssql-mcp-server |
@connorbritain/mssql-mcp-server |
Thin wrapper — startMcpServer({ tier: "admin" }) |
Rationale: Regulated enterprises want compile-time guarantees that certain builds cannot perform destructive operations. Each package activates only the tools appropriate for its tier via core's toolsets.ts. Separate packages provide hard separation with clear audit trails ("we only allow mssql-mcp-reader in prod").
This repo contains only:
src/node/src/index.ts— 12-line entry pointsrc/node/package.json— declares dependency on@connorbritain/mssql-mcp-core- Community/governance docs:
ROADMAP.md,GOVERNANCE_ROADMAP.md,README.md,CONTRIBUTING.md, etc. server.json— MCP Registry manifestenvironments.example.json— example multi-environment config
For tool implementations, see mssql-mcp-core/src/tools/. For server setup logic, see mssql-mcp-core/src/server/.
- Version: v0.4.5
- Core dependency:
@connorbritain/mssql-mcp-corev0.1.5 - Tier:
admin— all tools enabled (read, write, and DDL)
cd src/node
npm install
npm run build # Compile TypeScript to dist/
npm run watch # Watch mode for development
npm start # Run the compiled serverEntry point: src/node/src/index.ts
#!/usr/bin/env node
import { startMcpServer } from "@connorbritain/mssql-mcp-core";
import pkg from "../package.json" with { type: "json" };
startMcpServer({
name: "mssql-mcp-server",
version: pkg.version,
tier: "admin",
}).catch((e) => {
console.error("Fatal:", e);
process.exit(1);
});startMcpServer (in mssql-mcp-core/src/server/createMcpServer.ts) handles:
- MCP Server initialization via
@modelcontextprotocol/sdk - Tool registration filtered by tier via
mssql-mcp-core/src/server/toolsets.ts - EnvironmentManager for multi-database connections
- AuditLogger for JSONL audit logging
- IntentRouter for keyword-based environment routing
wrapToolRunmiddleware: policy enforcement, schema access control, audit
| Tier | Tools Included |
|---|---|
reader |
ReadDataTool, ListTableTool, DescribeTableTool, SearchSchemaTool, ProfileTableTool, RelationshipInspectorTool, ExplainQueryTool, ListDatabasesTool, ListEnvironmentsTool, ValidateEnvironmentConfigTool, TestConnectionTool, InspectDependenciesTool, ListScriptsTool, RunScriptTool |
writer |
All reader tools + InsertDataTool, UpdateDataTool, DeleteDataTool |
admin |
All writer tools + CreateTableTool, CreateIndexTool, DropTableTool |
All tool implementations live in mssql-mcp-core/src/tools/.
| Variable | Description |
|---|---|
SERVER_NAME |
SQL Server hostname |
DATABASE_NAME |
Target database |
SQL_AUTH_MODE |
sql, windows, or aad (default) |
READONLY |
true disables write tools globally |
ENVIRONMENTS_CONFIG_PATH |
Path to multi-environment JSON config |
AUDIT_LOG_PATH |
Audit log output path (default: logs/audit.jsonl) |
AUDIT_LOGGING |
false to disable audit logging |
This package activates all tools (admin tier):
Read-only:
list_tables,describe_table,read_datasearch_schema,profile_table,inspect_relationships,inspect_dependenciesexplain_query,list_databases,list_environments,validate_environment_configtest_connection,list_scripts,run_script
Write (disabled when READONLY=true):
insert_data,update_data,delete_data
Admin/DDL (disabled when READONLY=true):
create_table,create_index,drop_table
ReadDataToolvalidates all queries: must start with SELECT, blocks dangerous keywords- Automatic
TOP ninjection for queries without limits (MAX_ROWS_DEFAULT) update_dataanddelete_datarequire explicit confirmation flags- Audit logging with automatic sensitive data redaction (
mssql-mcp-core/src/audit/AuditLogger.ts) - Per-environment readonly and allowedTools policies (
mssql-mcp-core/src/server/wrapToolRun.ts) - Schema-level access control with wildcard patterns
requireApprovalenforcement for sensitive operations- Secret placeholder resolution via
mssql-mcp-core/src/config/SecretResolver.ts
cd src/node
# 1. Update version in package.json
# 2. Build
npm run build
# 3. Publish to npm
npm publish --access public
# 4. Tag the release
git tag v0.4.5
git push origin v0.4.5Test with Windsurf/Claude Desktop using mcp_config.json:
{
"mcpServers": {
"mssql": {
"command": "npx",
"args": ["@connorbritain/mssql-mcp-server@latest"],
"env": {
"ENVIRONMENTS_CONFIG_PATH": "/path/to/environments.json"
}
}
}
}See environments.example.json for multi-environment config format.