Skip to main content
Glama

hs-sql-agent

安全なSQLアクセスとエンタープライズガバナンスのための高性能MCPサーバー。

License: Apache 2.0 Docker NuGet CodeQL Advanced Tests Deploy on Zeabur

hs-sql-agent は、HTTP MCPエンドポイントと内蔵のAdmin Panelを通じて、MCPクライアントをSQLite、PostgreSQL、MySQL、SQL Server、Oracle、Firebirdに接続します。

hs-sql-agentを選ぶ理由

サーバーは、無制限のLLM生成SQLを実行する代わりに、サポートされているSQLを構造化定義に解析し、検証し、プロバイダー固有のSQLコンパイラを通じて最終ステートメントを再構築します。

  • 6つのデータベースプロバイダー — SQLite、PostgreSQL、MySQL、SQL Server、Oracle、Firebird。

  • 管理されたアクセス — キーごとのデータベースバインド、テーブルホワイトリスト、CORS、レート制限、実行ポリシー。

  • 安全なDML — トランザクションによるドライランに続き、明示的な人間の承認のためのMCP Elicitation。

  • Admin Panel — データベース、キー、ロール、カスタムツール、監査記録、実行時ポリシーの管理。

  • エンタープライズ対応 — OIDC SSO、TOTP MFA、監査保持、Prometheusメトリクス、OTLP、webhook/SIEM配信。

  • セマンティックメタデータ — テーブルとカラムの同義語、リレーションシップ、スキーマディスカバリのためのスコープ付きメトリックメタデータ。

SQLサポートは意図的に制限されています。サポートされていない構文は、意味を静かに変えるのではなく拒否されます。サポートされているSQL契約については、MCP Tools Reference を参照してください。

Related MCP server: safedb-mcp

クイックスタート

cp .env.example .env
# Set HMAC_KEY and JWT_KEY to unique secrets of at least 32 bytes.
docker compose up -d

Admin Panelを http://localhost:8080 で開きます。設定オプションと本番環境へのデプロイガイダンスは Wiki に記載されています。

MCPクライアントでの使用

Admin PanelでMCPキーを作成します。キーダイアログにはプレーンテキストのシークレットが一度だけ表示され、Claude Desktop、Cursor、および汎用Streamable HTTPクライアント用の設定が生成されます。

MCP_PUBLIC_ENDPOINT を、/mcp を含む外部から到達可能なMCP URLに設定します。クライアントの互換性、オンボーディング、DML Elicitationの要件については、MCPクライアントのオンボーディング を参照してください。

既存の.NET API向けNuGet

MCP SQL AgentとオプションのAdmin UIをASP.NET Coreアプリケーションに組み込みます:

dotnet add package HsSqlAgent.Server
builder.Services.AddHsSqlAgent(options => { ... });
app.UseHsSqlAgent();                    // API only
// app.UseHsSqlAgent().ServeAdminUi();  // API and Admin UI

設定とデプロイの詳細については、NuGet Packageガイド を参照してください。

SQL実行の仕組み

  1. MCPキーを認証し、そのデータベース、テーブル、ポリシースコープを適用します。

  2. サポートされているSQLを構造化定義に解析します。

  3. 定義を検証し、設定されたデータベースプロバイダー用にコンパイルします。

  4. 設定された制限内でクエリを実行します。

  5. DMLの場合、トランザクション内でドライランを実行し、コミット前にMCP Elicitationを通じて人間の承認を要求します。

カスタムSQLツールは、組み込みツールと同じパーサー、検証、アクセスポリシー、実行制限を通過します。ライフサイクル、パラメータ、公開ルールは Admin Panelガイド に記載されています。

ドキュメント

トピック

ドキュメント

はじめに

Getting Started

設定

Configuration

Admin Panel

Admin Panel

MCPツールとSQLサポート

MCP Tools Reference

セキュリティ、OIDC、MFA

Security Governance

デプロイと可観測性

Deployment · Distributed Deployment

API

API Reference

トラブルシューティング

Troubleshooting

開発

Development

SQL実行フロー

DML承認プロンプト

これは、execute_dml_sql 実行中のヒューマン・イン・ザ・ループ承認ステップの様子です:

コントリビューション

CONTRIBUTING.mdDevelopmentガイド を参照してください。

ライセンス

Apache License 2.0

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

No tool schema history has been recorded yet.

Maintenance

ActivityActive
ResponsivenessSyncing

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    F
    maintenance
    A Model Context Protocol (MCP) server that enables AI agents to interact with Microsoft SQL Server databases through secure, intelligent database operations. This server provides comprehensive CRUD capabilities, schema introspection, stored procedure execution, transaction management, and bulk opera
    829
    40
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Secure MCP server for safe, read-only DB access by AI agents, with SQL guardrails, table allowlists, PII masking, and audit logs
    6
    50
    7
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Secure and token-efficient MySQL MCP server built specifically for AI agents. Prevents hallucinations, optimizes context windows and blocks dangerous queries.
    5
    89
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    Automatically scans SQLite databases and generates typed CRUD tools for each table, allowing natural language database interaction without exposing raw SQL.
    12
    -

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/tse-wei-chen/hs-sql-agent'

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