sql-mcp
@yuuzu/sql-mcp
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)
ツール
ツール | 説明 |
| データベースサーバーに接続する |
| 現在の接続を切断する |
| 接続状態とクエリモードを確認する |
| サーバー上のすべてのデータベースを一覧表示する |
| 別のデータベースに切り替える |
| すべてのテーブルとビューを一覧表示する |
| テーブルのスキーマ詳細を取得する |
| SQLクエリを実行する |
クエリモード
SQL_MCP_MODE環境変数でクエリ権限を制御します:
モード | 許可される操作 | 説明 |
| SELECT, WITH, EXPLAIN | 読み取り専用、最も安全 |
| + INSERT, UPDATE, DELETE | データ変更を許可 |
| + 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これにより以下が実行されます:
プロジェクトのビルド
プロベナンス付きでnpmに公開
自動生成されたリリースノートを含むGitHubリリースの作成
要件: GitHubリポジトリ設定でNPM_TOKENシークレットを設定してください。
ライセンス
MIT
This server cannot be installed
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