mcp-database-universal
MCP Database Server
MCP対応AIエージェント向けのデータベース推論インターフェース — 単なるSQLラッパーではありません。
mcp-database-universal は、AIエージェントに 7つの推論ツール を提供し、データベースを安全に探索・クエリし、スキーマとデータ構造を理解し、自然言語の質問を実行し、リレーションシップを可視化します — すべて生の接続内部を公開することなく。
特徴
AIエージェント向けの7つの推論ツール: 接続テスト、テーブル一覧、テーブル検査、パラメータ化SQLの実行、平文での質問、データプロファイリング、ER図の描画。
マルチエンジン: SQLite(組み込み)に加え、PostgreSQL、MySQL、MSSQLをオプションでサポート。
安全性最優先: デフォルトで読み取り専用、パラメータ化クエリ、ステートメント検証、行数・時間・出力サイズの制限。
LLMに優しい出力: 型を変換し、
NULLを処理し、結果をMarkdownテーブルでコンテキスト付きで整形。スキーマイントロスペクション: テーブル、カラム、インデックス、外部キー、リレーションシップを自動検出。
自然言語クエリ: 平文の質問をSQLに変換し、結果を返します。
Related MCP server: Universal Database MCP Server
サポートされているエンジン
エンジン | 要件 | 追加インストール |
SQLite | 組み込み | — |
PostgreSQL | psycopg |
|
MySQL | PyMySQL |
|
MSSQL | pyodbc + ODBCドライバ |
|
すべて | — |
|
インストール
pip install mcp-database-universal
# With optional engines:
pip install "mcp-database-universal[postgres]"
pip install "mcp-database-universal[mysql]"
pip install "mcp-database-universal[mssql]"
# or everything:
pip install "mcp-database-universal[all]"クイックスタート
STDIO(MCPクライアントのデフォルトトランスポート)でサーバーを実行します:
DATABASE_URL=sqlite:///app.db python -m mcp_database_universal接続URL:
sqlite:///path/to/db.db SQLite (file)
sqlite:///:memory: SQLite (in-memory)
postgresql://user:pass@host:5432/db PostgreSQL
mysql://user:pass@host:3306/db MySQL
mssql://user:pass@host:1433/db MSSQL (uses ODBC Driver 18)Docker
docker build -t mcp-db .
# Mount a SQLite database read-only:
docker run --rm -i \
-v /host/path/app.db:/data/app.db:ro \
-e DATABASE_URL=sqlite:////data/app.db \
mcp-db
# Or in-memory:
docker run --rm -i -e DATABASE_URL=sqlite:///:memory: mcp-db設定
すべての設定は環境変数で行います。
変数 | デフォルト | 説明 |
| (必須) | データベース接続URL。 |
|
| 読み取り専用モードを強制( |
|
|
|
|
| クエリごとに返される最大行数。 |
|
| クエリのタイムアウト(秒)。 |
|
| 結果ペイロードのサイズ上限。 |
|
| テーブル/カラム統計で表示されるサンプル行数。 |
|
| プロファイリングでの上位N値の分布エントリ。 |
| — | LLMベースの |
| — | LLMベースの |
ツール
ツール | 説明 |
| DB接続をテストし、エンジン、バージョン、名前、サイズ、テーブル数を報告。 |
| 行数、カラム数、FKリレーションシップを含む全テーブルの概要。 |
| 1つのテーブルの完全な構造: カラム、型、インデックス、FK、サンプルデータ。 |
| 安全なパラメータ化SQLクエリを実行し、Markdown結果を取得。 |
| 平文で質問し、生成されたSQLと結果を取得。 |
| データプロファイル: 分布、NULL率、リレーションシップ、サイズ。 |
| テーブルリレーションシップのMermaid ER図。 |
例: パラメータ付き query
{
"sql": "SELECT * FROM users WHERE id = :id AND active = :active",
"params": "{\"id\": 42, \"active\": true}"
}パラメータは :name プレースホルダーを使用します。params にJSON文字列として値を渡します。
例: natural_query
question: "How many users are there?"
-> SELECT COUNT(*) FROM users
question: "Show me all orders"
-> SELECT * FROM orders LIMIT 100小さなサンプルデータベースに対する動作例は examples/ にあり、一般的なMCPクライアント用のすぐ使える設定スニペットも同梱されています。
MCPクライアント設定
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"database": {
"command": "python",
"args": ["-m", "mcp_database_universal"],
"env": {"DATABASE_URL": "sqlite:///C:/data/app.db"}
}
}
}Cursor / その他のCLIベースのクライアント
{
"mcpServers": {
"database": {
"command": "uvx",
"args": ["mcp-database-universal"],
"env": {"DATABASE_URL": "sqlite:///C:/data/app.db"}
}
}
}Windowsに関する注意: 非同期PostgresドライバーはWindowsセレクターイベントループを必要とします。このパッケージは
win32で自動的にこのポリシーを設定するため、追加設定は不要です。
開発
pip install -e ".[dev]"
pytestPostgreSQL/MySQLの統合テストはDocker Composeを使用し、サーバーに到達できない場合は自動的にスキップされます:
docker compose -f tests/integration/docker-compose.yml up -d
pytest安全性モデル
サーバーはデフォルトで読み取り専用です。
INSERT/UPDATE/DELETE/DROP/ALTERなどの書き込みステートメントはブロックされます。書き込みは、オペレーターが明示的に
DATABASE_READ_ONLY=falseかつDATABASE_WRITE_ENABLED=trueを設定した場合のみ可能です。クエリ結果は行数、タイムアウト、出力サイズで制限され、暴走クエリは防止されます。
ライセンス
MIT
This server cannot be installed
Maintenance
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
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to query and explore databases including SQLite, PostgreSQL, MySQL, and SQL Server through a secure, read-only workflow. It provides tools for listing connections, inspecting table schemas, and executing SELECT statements directly within VS Code.1
- AlicenseNot gradedqualityAmaintenanceConnect AI agents to SQL databases (SQLite, PostgreSQL, MySQL) with a unified interface for querying data, exploring schemas, inserting rows, and exporting results to CSV. Includes safety features like dangerous query blocking and write guards.13MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to connect to and interact with PostgreSQL, MySQL, SQLite, and MongoDB databases through natural language, supporting schema exploration, query execution, data export, and more.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to interact with PostgreSQL or MySQL databases using natural language. Supports SQL queries, schema discovery, and pre-built aggregations without writing SQL.289MIT
Related MCP Connectors
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Give your agent live data from Twitter, Reddit, the web and GitHub. No API keys, no scraping stack.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/kobramantra-debug/mcp-database-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server