DB-Explorer-MCP
Database Explorer MCP
リレーショナルデータベースを探索・安全にクエリするためのFastMCPサーバーです。ローカル開発用データベースはSQLiteです。SQLAlchemyはドライバを通じてPostgreSQLやMySQLにも対応しています。
アーキテクチャ
MCPクライアントは自然言語による推論を行い、SQLを生成します。このサーバーはデータベースツールを公開し、読み取り専用クエリを検証・実行し、構造化された結果を返します。
MCP client LLM -> FastMCP tools -> safety layer -> SQLAlchemy -> databaseこのサーバーはAnthropicを呼び出さないため、Anthropic APIキーは不要です。
Related MCP server: nl2sql-mcp
セットアップ
uvをインストールし、このディレクトリで次を実行します:
uv sync
uv run python tests/seed_test_db.py
uv run pytestuvがまだPATHにない場合は、次を使用します:
py -m uv sync
py -m uv run pytestデフォルトのデータベースは次のとおりです:
sqlite:///sample.db別のデータベースを使用するには、サーバーを起動する前にDATABASE_URLを設定します。例:
$env:DATABASE_URL = "sqlite:///C:/data/example.db"
$env:DATABASE_URL = "postgresql+psycopg2://user:password@localhost:5432/example"
$env:DATABASE_URL = "mysql+pymysql://user:password@localhost:3306/example"MCPサーバーを実行する
uv run server.py共有可能なVS Code MCP設定は.vscode/mcp.jsonにあります。stdio経由でサーバーを起動し、MCP互換クライアントやInspectorで使用できます。
リモートホスティングの場合は、Streamable HTTPを使用します:
$env:MCP_TRANSPORT = "streamable-http"
$env:MCP_HOST = "0.0.0.0"
$env:MCP_PORT = "8000"
uv run server.pyリモートデプロイメントは認証を提供し、シークレット設定を通じてDATABASE_URLを保護する必要があります。
ツール
explore_schema:テーブルの一覧表示または1つのテーブルの調査execute_query:安全な読み取り専用SELECTを1回実行explain_query:ネイティブ実行プランを返すvalidate_schema:欠落した主キーとインデックスなし外部キーを報告suggest_index:テーブルメタデータまたはクエリプランからインデックスを提案migration_context:クライアント側のマイグレーション生成用のスキーマコンテキストを提供validate_migration:提案されたUPスクリプトとDOWNスクリプトを実行せずに検証
すべてのクエリ実行と説明はセーフティレイヤーを通過します。変更ステートメント、コメント、複数ステートメントは拒否されます。クエリ結果はデフォルトで最大100行です。
テスト
uv run pytestテストスイートは一時的なSQLiteデータベースを使用するため、外部認証情報や実行中のデータベースサーバーは不要です。
リモートデプロイ
FastMCP Horizonのデプロイ手順、リモートデータベースの要件、認証チェックリストについては、DEPLOYMENT.mdを参照してください。
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 gradedqualityDmaintenanceAn MCP server that provides safe, read-only access to SQLite databases through MCP. This server is built with the FastMCP framework, which enables LLMs to explore and query SQLite databases with built-in safety features and query validation.107
- FlicenseNot gradedqualityFmaintenanceA production-ready MCP server that transforms natural language into safe, executable SQL queries with multi-database support and intelligent schema analysis.1
- AlicenseNot gradedqualityDmaintenanceA read-only MCP server for PostgreSQL that enables safe database introspection and querying via natural language.539MIT
- AlicenseNot gradedqualityAmaintenanceRead-only Text-to-SQL MCP server for PostgreSQL and MySQL that lets users query databases using natural language, with robust multi-layer safety guarantees against writes.22MIT
Related MCP Connectors
GibsonAI MCP server: manage your databases with natural language
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
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/AYUSH-148/DB-Explorer-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server