sql-mcp
@yuuzu/sql-mcp
MSSQL、PostgreSQL、およびSQLiteデータベース操作用のModel Context Protocol (MCP) サーバーです。
インストール
# Using bunx (recommended)
bunx @yuuzu/sql-mcp
# Using npx
npx @yuuzu/sql-mcpRelated MCP server: Database MCP Server
機能
マルチデータベースサポート: 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 deployed
Maintenance
Related MCP Connectors
Draxlr's remote MCP server connects AI assistants to your SQL databases and dashboards. Explore schemas, run read-only queries, manage saved queries and dashboards, and export results, all with row-level security so each user sees only their own data.
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- AlicenseBqualityDmaintenanceA 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.101394MIT
- FlicenseNot gradedqualityDmaintenanceA 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-

MCP TapData Serverofficial
FlicenseNot gradedqualityDmaintenanceA 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.-- FlicenseNot gradedqualityCmaintenanceA 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.-