hs-sql-agent
hs-sql-agent
安全なSQLアクセスとエンタープライズガバナンスのための高性能MCPサーバー。
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 -dAdmin 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.Serverbuilder.Services.AddHsSqlAgent(options => { ... });
app.UseHsSqlAgent(); // API only
// app.UseHsSqlAgent().ServeAdminUi(); // API and Admin UI設定とデプロイの詳細については、NuGet Packageガイド を参照してください。
SQL実行の仕組み
MCPキーを認証し、そのデータベース、テーブル、ポリシースコープを適用します。
サポートされているSQLを構造化定義に解析します。
定義を検証し、設定されたデータベースプロバイダー用にコンパイルします。
設定された制限内でクエリを実行します。
DMLの場合、トランザクション内でドライランを実行し、コミット前にMCP Elicitationを通じて人間の承認を要求します。
カスタムSQLツールは、組み込みツールと同じパーサー、検証、アクセスポリシー、実行制限を通過します。ライフサイクル、パラメータ、公開ルールは Admin Panelガイド に記載されています。
ドキュメント
トピック | ドキュメント |
はじめに | |
設定 | |
Admin Panel | |
MCPツールとSQLサポート | |
セキュリティ、OIDC、MFA | |
デプロイと可観測性 | |
API | |
トラブルシューティング | |
開発 |
SQL実行フロー
DML承認プロンプト
これは、execute_dml_sql 実行中のヒューマン・イン・ザ・ループ承認ステップの様子です:
コントリビューション
CONTRIBUTING.md と Developmentガイド を参照してください。
ライセンス
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.
This server cannot be installed
Maintenance
Related MCP Connectors
Deterministic safety, correctness & cost gate that vets Postgres SQL before your AI agent runs it.
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
- mcpOAuthcom.gibsonai
GibsonAI MCP server: manage your databases with natural language
AgentGuard — 20-tool AI safety MCP: policy preflight, risk scoring, audit logging, rate limits.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceA 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 opera82940MIT
- AlicenseAqualityCmaintenanceSecure MCP server for safe, read-only DB access by AI agents, with SQL guardrails, table allowlists, PII masking, and audit logs6507MIT
- AlicenseAqualityCmaintenanceSecure and token-efficient MySQL MCP server built specifically for AI agents. Prevents hallucinations, optimizes context windows and blocks dangerous queries.589MIT
- FlicenseAqualityDmaintenanceAutomatically scans SQLite databases and generates typed CRUD tools for each table, allowing natural language database interaction without exposing raw SQL.12-
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/tse-wei-chen/hs-sql-agent'
If you have feedback or need assistance with the MCP directory API, please join our Discord server