Skip to main content
Glama

@yuuzu/sql-mcp

CI npm version

Сервер протокола контекста модели (MCP) для работы с базами данных MSSQL, PostgreSQL и SQLite.

Установка

# Using bunx (recommended)
bunx @yuuzu/sql-mcp

# Using npx
npx @yuuzu/sql-mcp

Related MCP server: Database MCP Server

Возможности

  • Поддержка нескольких баз данных: MSSQL, PostgreSQL и SQLite (через better-sqlite3)

  • 8 инструментов для операций с базами данных

  • Три режима запросов: safe (безопасный), write (запись), full (полный)

  • Расширенная аутентификация: Windows Auth (MSSQL), SSL-сертификаты (PostgreSQL)

Инструменты

Инструмент

Описание

connect-database

Подключение к серверу базы данных

disconnect

Отключение от текущего соединения

connection-status

Проверка статуса соединения и режима запросов

list-databases

Список всех баз данных на сервере

switch-database

Переключение на другую базу данных

list-tables

Список всех таблиц и представлений

describe-table

Получение подробной информации о схеме таблицы

execute-query

Выполнение SQL-запросов

Режимы запросов

Управляйте правами доступа к запросам через переменную окружения SQL_MCP_MODE:

Режим

Разрешенные операции

Описание

safe (по умолчанию)

SELECT, WITH, EXPLAIN

Только чтение, самый безопасный

write

+ INSERT, UPDATE, DELETE

Разрешает изменение данных

full

+ CREATE, DROP, ALTER, TRUNCATE

Полный доступ, используйте с осторожностью

Примечание: Инструкции PRAGMA (например, PRAGMA table_info(users)) разрешены во всех режимах, включая safe, так как это запросы метаданных только для чтения, часто используемые в SQLite.

# Example: Enable write mode
SQL_MCP_MODE=write bunx @yuuzu/sql-mcp

Примеры использования

Конфигурация Claude Desktop

Добавьте в ваш claude_desktop_config.json:

{
    "mcpServers": {
        "sql-mcp": {
            "command": "bunx",
            "args": ["@yuuzu/sql-mcp"],
            "env": {
                "SQL_MCP_MODE": "safe"
            }
        }
    }
}

Подключение к MSSQL

{
    "tool": "connect-database",
    "arguments": {
        "engine": "mssql",
        "server": "localhost",
        "port": 1433,
        "user": "sa",
        "password": "your_password",
        "database": "master"
    }
}

Подключение к PostgreSQL

{
    "tool": "connect-database",
    "arguments": {
        "engine": "postgres",
        "server": "localhost",
        "port": 5432,
        "user": "postgres",
        "password": "your_password",
        "database": "postgres"
    }
}

Подключение с использованием Windows Authentication (MSSQL)

{
    "tool": "connect-database",
    "arguments": {
        "engine": "mssql",
        "server": "localhost",
        "windowsAuth": true
    }
}

Подключение с использованием SSL (PostgreSQL)

{
    "tool": "connect-database",
    "arguments": {
        "engine": "postgres",
        "server": "your-server.com",
        "user": "postgres",
        "password": "your_password",
        "ssl": {
            "rejectUnauthorized": true,
            "ca": "/path/to/ca-certificate.crt"
        }
    }
}

Подключение к SQLite (файл)

{
    "tool": "connect-database",
    "arguments": {
        "engine": "sqlite",
        "filename": "/absolute/path/to/database.db"
    }
}

Подключение к SQLite (в оперативной памяти)

Полезно для тестирования, демонстраций или временных рабочих пространств.

{
    "tool": "connect-database",
    "arguments": {
        "engine": "sqlite",
        "filename": ":memory:"
    }
}

Подключение к SQLite (только для чтения)

{
    "tool": "connect-database",
    "arguments": {
        "engine": "sqlite",
        "filename": "/absolute/path/to/database.db",
        "readonly": true,
        "fileMustExist": true
    }
}

Примечание по среде выполнения SQLite: Поддержка SQLite использует better-sqlite3, для работы которого требуется Node.js. При запуске через bunx MSSQL и PostgreSQL работают нормально, но соединения с SQLite вернут понятную ошибку с указанием использовать npx или node.

Разработка

# Install dependencies
bun install

# Run in development mode
bun run dev

# Run tests
bun test

# Run tests with coverage
bun test --coverage

# Build
bun run build

# Type check
bun run typecheck

Релиз

Релизы автоматизированы через GitHub Actions. Чтобы создать новый релиз:

# Create and push a version tag
git tag v1.0.0
git push origin v1.0.0

Это действие:

  1. Соберет проект

  2. Опубликует его в npm с подтверждением происхождения (provenance)

  3. Создаст GitHub Release с автоматически сгенерированными примечаниями к выпуску

Требования: Установите секрет NPM_TOKEN в настройках вашего репозитория GitHub.

Лицензия

MIT

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

Maintenance

Maintainers
Response time
4wRelease cycle
4Releases (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
    A Model Context Protocol server that enables secure interaction with Microsoft SQL Server databases, allowing AI assistants to list tables, read data, and execute SQL queries through a controlled interface.
    1
    381
    MIT
  • F
    license
    -
    quality
    D
    maintenance
    A Model Context Protocol server that provides tools for connecting to and interacting with various database systems (SQLite, PostgreSQL, MySQL/MariaDB, SQL Server) through a unified interface.
    3
  • F
    license
    -
    quality
    D
    maintenance
    A Model Context Protocol server that enables Large Language Models to access and interact with database connections, including viewing schemas and performing CRUD operations on connected databases.
  • F
    license
    -
    quality
    C
    maintenance
    A Model Context Protocol server that allows Large Language Models like Claude to execute SQL queries, explore database schemas, and maintain persistent connections to SQL Server databases.

View all related MCP servers

Related MCP Connectors

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

  • MCP server for managing Prisma Postgres.

  • A Model Context Protocol server for Wix AI tools

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/NakiriYuuzu/sql-mcp'

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