Skip to main content
Glama
kyle66889

mcp-sqlserver

by kyle66889

MCP SQL Server

Microsoft SQL Server용 읽기 전용 Model Context Protocol (MCP) 서버로, AI 에이전트가 SQL Server 데이터베이스를 안전하게 탐색하고 쿼리할 수 있게 해줍니다.

빠른 시작

1단계: 패키지 설치

# Global installation (recommended)
npm install -g @bilims/mcp-sqlserver

# Verify installation
mcp-sqlserver --version

2단계: SQL Server 연결 구성

SQL Server 유형을 선택하고 구성 방법을 따르세요:

Azure SQL Database

export SQLSERVER_HOST="your-server.database.windows.net"
export SQLSERVER_USER="your-username"
export SQLSERVER_PASSWORD="your-password"
export SQLSERVER_DATABASE="your-database"
export SQLSERVER_ENCRYPT="true"
export SQLSERVER_TRUST_CERT="false"

온프레미스 SQL Server

export SQLSERVER_HOST="your-sql-server.company.com"
export SQLSERVER_USER="your-username"
export SQLSERVER_PASSWORD="your-password"
export SQLSERVER_DATABASE="your-database"
export SQLSERVER_ENCRYPT="true"
export SQLSERVER_TRUST_CERT="true"  # For self-signed certificates

로컬 SQL Server Express

export SQLSERVER_HOST="localhost\\SQLEXPRESS"
export SQLSERVER_USER="sa"
export SQLSERVER_PASSWORD="your-password"
export SQLSERVER_DATABASE="master"
export SQLSERVER_ENCRYPT="false"
export SQLSERVER_TRUST_CERT="true"

3단계: 연결 테스트

# Test your configuration
mcp-sqlserver --help

# Quick connection test (press Ctrl+C to exit)
mcp-sqlserver

4단계: Claude Desktop에 추가

  1. Claude Desktop 구성 파일을 찾으세요:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

    • Windows: %APPDATA%\Claude\claude_desktop_config.json

  2. MCP 서버 구성을 추가하세요:

{
  "mcpServers": {
    "sqlserver": {
      "command": "mcp-sqlserver",
      "env": {
        "SQLSERVER_HOST": "your-server.database.windows.net",
        "SQLSERVER_USER": "your-username",
        "SQLSERVER_PASSWORD": "your-password",
        "SQLSERVER_DATABASE": "your-database",
        "SQLSERVER_ENCRYPT": "true",
        "SQLSERVER_TRUST_CERT": "false"
      }
    }
  }
}
  1. Claude Desktop을 다시 시작하세요

5단계: 탐색 시작!

Claude Desktop에서 다음 명령을 시도해 보세요:

  • "Test the SQL Server connection"

  • "List all databases on the server"

  • "Show me the tables in [database name]"

  • "Describe the structure of the Users table"

  • "Show me foreign key relationships"

Related MCP server: SQL Server MCP

기능

  • 🔒 읽기 전용 작업: 포괄적인 보안 검증과 함께 SELECT 쿼리만 허용됩니다

  • 🗄️ 스키마 검색: 데이터베이스, 테이블, 뷰, 관계 및 메타데이터를 탐색합니다

  • 📊 데이터 탐색: 기본 제공되는 제한 및 시간 초과와 함께 안전한 쿼리를 실행합니다

  • 🔐 엔터프라이즈 지원: 프로덕션 환경을 위한 인증서 신뢰 기반 암호화 연결

  • 🛡️ 보안 우선: 쿼리 검증, SQL 인젝션 보호 및 액세스 제어

사용 가능한 도구

스키마 검색

  • list_databases - SQL Server 인스턴스의 모든 데이터베이스 나열

  • list_tables - 데이터베이스 또는 스키마의 테이블 나열

  • list_views - 데이터베이스 또는 스키마의 뷰 나열

  • describe_table - 열, 데이터 형식 및 제약 조건을 포함한 상세 테이블 스키마 가져오기

관계 분석

  • get_foreign_keys - 테이블의 외래 키 관계 가져오기

  • get_table_stats - 행 수 및 크기 정보를 포함한 테이블 통계 가져오기

데이터 탐색

  • execute_query - 안전성 검증을 통해 읽기 전용 SELECT 쿼리 실행

  • get_server_info - SQL Server 버전, 에디션 및 구성 세부 정보 가져오기

Claude Desktop용 일반 명령

MCP 서버가 구성되면 다음 자연어 명령을 시도해 보세요:

시작 명령

"Test the SQL Server connection"
"Show me server information"
"List all databases on this server"
"What tables are in the [database name] database?"

데이터베이스 탐색

"Describe the structure of the Users table"
"Show me foreign key relationships in this database"
"What are the largest tables by row count?"
"Give me a sample of data from the Orders table"

고급 분석

"Help me understand the relationship between Orders and Customers"
"Show me all lookup tables in this database"
"What columns contain date/time information?"
"Find tables that might contain user authentication data"

사용자 지정 쿼리

"Run this query: SELECT TOP 10 * FROM Products WHERE Price > 100"
"Show me all customers created in the last 30 days"
"What are the different product categories in the database?"

설치

npm install
npm run build

구성

서버는 환경 변수를 사용하여 구성됩니다:

필수

  • SQLSERVER_USER - SQL Server 사용자 이름

  • SQLSERVER_PASSWORD - SQL Server 비밀번호

선택 사항

  • SQLSERVER_HOST - 서버 호스트 이름 (기본값: localhost)

  • SQLSERVER_DATABASE - 기본 데이터베이스 이름

  • SQLSERVER_PORT - 포트 번호 (기본값: 1433)

  • SQLSERVER_ENCRYPT - 암호화 활성화 (기본값: true)

  • SQLSERVER_TRUST_CERT - 서버 인증서 신뢰 (기본값: true)

  • SQLSERVER_CONNECTION_TIMEOUT - 연결 시간 초과(ms) (기본값: 30000)

  • SQLSERVER_REQUEST_TIMEOUT - 요청 시간 초과(ms) (기본값: 60000)

  • SQLSERVER_MAX_ROWS - 쿼리당 최대 행 수 (기본값: 1000)

사용법

환경 변수

export SQLSERVER_HOST="your-server.database.windows.net"
export SQLSERVER_USER="your-username"
export SQLSERVER_PASSWORD="your-password"
export SQLSERVER_DATABASE="your-database"
export SQLSERVER_ENCRYPT="true"
export SQLSERVER_TRUST_CERT="true"

서버 실행

npm start

설치 옵션

옵션 1: 전역 설치 (권장)

npm install -g @bilims/mcp-sqlserver

옵션 2: 로컬 설치

npm install @bilims/mcp-sqlserver
npx mcp-sqlserver

옵션 3: npx로 실행 (설치 없음)

npx @bilims/mcp-sqlserver

통합 예제

Claude Desktop

Claude Desktop 구성(claude_desktop_config.json)에 추가하세요:

{
  "mcpServers": {
    "sqlserver": {
      "command": "mcp-sqlserver",
      "env": {
        "SQLSERVER_HOST": "your-server.database.windows.net",
        "SQLSERVER_USER": "your-username",
        "SQLSERVER_PASSWORD": "your-password",
        "SQLSERVER_DATABASE": "your-database"
      }
    }
  }
}

Claude Code CLI

# Set environment variables
export SQLSERVER_HOST="your-server"
export SQLSERVER_USER="your-username"
export SQLSERVER_PASSWORD="your-password"

# Use with Claude Code
claude mcp add sqlserver mcp-sqlserver

VSCode와 MCP 확장

VSCode용 MCP 확장을 설치하고 서버 구성을 추가하세요.

보안 기능

쿼리 검증

  • SELECT, WITH, SHOW, DESCRIBE 및 EXPLAIN 문만 허용됩니다

  • 위험한 키워드에 대한 포괄적인 블랙리스트 (INSERT, UPDATE, DELETE, DROP 등)

  • SQL 인젝션 패턴 탐지

  • 자동 쿼리 정화

연결 보안

  • TLS/SSL 암호화 기본 활성화

  • 엔터프라이즈 환경을 위한 서버 인증서 신뢰 옵션

  • 시간 초과 제어 기능이 있는 연결 풀링

  • 구성 가능한 요청 시간 초과

결과 제한

  • 쿼리당 최대 행 수 제한 (구성 가능)

  • SELECT 쿼리에 대한 자동 TOP 절 삽입

  • 쿼리 실행 시간 추적

  • 메모리 사용량 보호

예제 쿼리

연결되면 MCP 클라이언트를 통해 도구를 사용할 수 있습니다:

// List all databases
await callTool("list_databases", {});

// List tables in a specific schema
await callTool("list_tables", { schema: "dbo" });

// Get table schema details
await callTool("describe_table", { 
  table_name: "Users", 
  schema: "dbo" 
});

// Execute a read-only query
await callTool("execute_query", { 
  query: "SELECT TOP 10 * FROM Users WHERE active = 1",
  limit: 10
});

// Get foreign key relationships
await callTool("get_foreign_keys", { 
  table_name: "Orders" 
});

개발

# Install dependencies
npm install

# Build the project
npm run build

# Run in development mode
npm run dev

# Run linting
npm run lint

# Run tests
npm test

문제 해결

연결 문제

  1. 서버 호스트 이름과 포트를 확인하세요

  2. 암호화/인증서 설정이 SQL Server 구성과 일치하는지 확인하세요

  3. 사용자에게 적절한 읽기 권한이 있는지 확인하세요

  4. 먼저 SQL Server Management Studio를 사용하여 연결을 테스트하세요

권한 문제

사용자 계정에는 최소한 다음이 필요합니다:

  • 데이터베이스에 대한 CONNECT 권한

  • 쿼리하려는 테이블/뷰에 대한 SELECT 권한

  • 메타데이터 쿼리를 위한 시스템 뷰 액세스

일반적인 SQL Server 구성

Azure SQL Database

export SQLSERVER_HOST="your-server.database.windows.net"
export SQLSERVER_ENCRYPT="true"
export SQLSERVER_TRUST_CERT="false"

자체 서명 인증서를 사용하는 온프레미스 SQL Server

export SQLSERVER_HOST="sql-server.company.com"
export SQLSERVER_ENCRYPT="true" 
export SQLSERVER_TRUST_CERT="true"

라이선스

MIT

기여

  1. 저장소를 포크하세요

  2. 기능 브랜치를 만드세요

  3. 변경 사항을 적용하세요

  4. 해당되는 경우 테스트를 추가하세요

  5. 풀 리퀘스트를 제출하세요

지원

문제 및 질문이 있는 경우:

  • 위의 문제 해결 섹션을 확인하세요

  • SQL Server 연결 문서를 검토하세요

  • MCP 클라이언트 호환성을 확인하세요


원활한 AI 통합을 위해 Model Context Protocol SDK로 구축되었습니다.

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    An MCP server that connects AI assistants to Microsoft SQL Server databases, enabling schema exploration and read-only queries safely.
    49
    23
    4
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Read-only SQL Server MCP server enabling safe database queries, table listing, and schema inspection with built-in security protections.
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    A read-only MCP server for exploring on-premises, multi-instance Microsoft SQL Server estates from AI clients, with read-only enforcement and Windows authentication support.
    Apache 2.0

View all related MCP servers

Related MCP Connectors

  • Official Microsoft MCP Server to query Microsoft Entra data using natural language

  • MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.

  • GibsonAI MCP server: manage your databases with natural language

View all MCP Connectors

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/kyle66889/mcp-sqlserver'

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