Skip to main content
Glama
AYUSH-148

DB-Explorer-MCP

by AYUSH-148

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 pytest

uvがまだ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を参照してください。

Install Server
F
license - not found
A
quality
A
maintenance

Maintenance

Maintainers
7hResponse time
Release cycle
Releases (12mo)
Commit activity

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

  • F
    license
    Not graded
    quality
    D
    maintenance
    An 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
  • F
    license
    Not graded
    quality
    F
    maintenance
    A production-ready MCP server that transforms natural language into safe, executable SQL queries with multi-database support and intelligent schema analysis.
    1
  • A
    license
    Not graded
    quality
    D
    maintenance
    A read-only MCP server for PostgreSQL that enables safe database introspection and querying via natural language.
    539
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Read-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.
    22
    MIT

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

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/AYUSH-148/DB-Explorer-MCP'

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