Skip to main content
Glama

@yuuzu/sql-mcp

CI npm version

MSSQL、PostgreSQL、およびSQLiteデータベース操作用のModel Context Protocol (MCP) サーバーです。

インストール

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

# Using npx
npx @yuuzu/sql-mcp

機能

  • マルチデータベースサポート: MSSQL、PostgreSQL、SQLite (better-sqlite3経由)

  • 8つのツール: データベース操作用

  • 3つのクエリモード: safe、write、full

  • 高度な認証: Windows認証 (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)) は、SQLiteで一般的に使用される読み取り専用のメタデータクエリであるため、safeを含むすべてのモードで許可されています。

# 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認証での接続 (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サポートはNode.jsを必要とするbetter-sqlite3を使用します。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に公開

  3. 自動生成されたリリースノートを含むGitHubリリースの作成

要件: GitHubリポジトリ設定でNPM_TOKENシークレットを設定してください。

ライセンス

MIT

-
security - not tested
F
license - not found
-
quality - 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/NakiriYuuzu/sql-mcp'

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