MCP Databricks Server
Databricks MCP サーバー
これは、Statement Execution APIを使用してDatabricksに対してSQLクエリを実行するためのモデルコンテキストプロトコル(MCP)サーバーです。Databricks APIを使用してSQLリクエストを実行し、データを取得できます。エージェントモードで使用すると、多数のリクエストを反復処理して複雑なタスクを実行できます。Unityカタログメタデータと組み合わせると、さらに優れたパフォーマンスを発揮します。
特徴
DatabricksでSQLクエリを実行する
カタログ内の利用可能なスキーマを一覧表示する
スキーマ内のテーブルを一覧表示する
テーブルスキーマを説明する
Related MCP server: Databricks MCP Server
設定
システム要件
Python 3.10以上
uv経由でインストールする場合は、インストールされていることを確認してください
インストール
必要な依存関係をインストールします。
pip install -r requirements.txtまたはuvを使用する場合:
uv pip install -r requirements.txt環境変数を設定します。
オプション 1: .env ファイルを使用する (推奨)
Databricks の資格情報を使用して .env ファイルを作成します。
DATABRICKS_HOST=your-databricks-instance.cloud.databricks.com DATABRICKS_TOKEN=your-databricks-access-token DATABRICKS_SQL_WAREHOUSE_ID=your-sql-warehouse-idオプション2: 環境変数を直接設定する
export DATABRICKS_HOST="your-databricks-instance.cloud.databricks.com" export DATABRICKS_TOKEN="your-databricks-access-token" export DATABRICKS_SQL_WAREHOUSE_ID="your-sql-warehouse-id"
SQL ウェアハウス ID は、Databricks UI の SQL ウェアハウスの下にあります。
権限要件
この MCP サーバーを使用する前に、次の点を確認してください。
SQL ウェアハウスの権限: 提供されたトークンに関連付けられたユーザーには、指定された SQL ウェアハウスにアクセスするための適切な権限が必要です。ウェアハウスの権限は、Databricks UI の「SQL ウェアハウス」>「[ウェアハウス名]」>「権限」で設定できます。
トークンの権限:使用する個人用アクセストークンには、必要な操作を実行するために必要な最小限の権限が付与されている必要があります。以下の点を強く推奨します。
このアプリケーション専用のトークンを作成する
セキュリティリスクを制限するために、可能な場合は読み取り専用権限を付与します。
ワークスペース全体の管理者権限を持つトークンの使用を避ける
データ アクセス権限: トークンに関連付けられたユーザーには、クエリの対象となるカタログ、スキーマ、およびテーブルにアクセスするための適切な権限が必要です。
Databricks REST API 経由で SQL ウェアハウスの権限を設定するには、以下を使用できます。
現在の権限を確認するには、
GET /api/2.0/sql/permissions/warehouses/{warehouse_id}権限を更新するには、
PATCH /api/2.0/sql/permissions/warehouses/{warehouse_id}ます。
セキュリティのベスト プラクティスとして、アクセス トークンを定期的にローテーションし、クエリ履歴を監査して使用状況を監視することを検討してください。
サーバーの実行
スタンドアロンモード
サーバーをスタンドアロン モードで実行するには:
python main.pyこれにより、stdio トランスポートを使用して MCP サーバーが起動し、Agent Composer またはその他の MCP クライアントで使用できるようになります。
カーソルの使用
この MCP サーバーをCursorで使用するには、Cursor 設定で構成する必要があります。
ホームディレクトリに
.cursorディレクトリがまだ存在しない場合は作成します。そのディレクトリに
mcp.jsonファイルを作成または編集します。
mkdir -p ~/.cursor
touch ~/.cursor/mcp.json次の構成を
mcp.jsonファイルに追加し、ディレクトリ パスをこのサーバーをインストールした実際のパスに置き換えます。
{
"mcpServers": {
"databricks": {
"command": "uv",
"args": [
"--directory",
"/path/to/your/mcp-databricks-server",
"run",
"main.py"
]
}
}
}uvを使用していない場合は、代わりにpythonを使用できます。
{
"mcpServers": {
"databricks": {
"command": "python",
"args": [
"/path/to/your/mcp-databricks-server/main.py"
]
}
}
}変更を適用するにはカーソルを再起動してください
これで、Cursor の AI アシスタント内で Databricks MCP サーバーを直接使用できるようになります。
利用可能なツール
サーバーは次のツールを提供します。
execute_sql_query: SQLクエリを実行し、結果を返すexecute_sql_query(sql: str) -> strlist_schemas: 特定のカタログで利用可能なすべてのスキーマを一覧表示するlist_schemas(catalog: str) -> strlist_tables: 特定のスキーマ内のすべてのテーブルを一覧表示するlist_tables(schema: str) -> strdescribe_table: テーブルのスキーマを記述するdescribe_table(table_name: str) -> str
使用例
Agent Composer またはその他の MCP クライアントでは、次のようなツールを使用できます。
execute_sql_query("SELECT * FROM my_schema.my_table LIMIT 10")
list_schemas("my_catalog")
list_tables("my_catalog.my_schema")
describe_table("my_catalog.my_schema.my_table")長時間実行クエリの処理
サーバーは、クエリが完了するかタイムアウトするまで、Databricks API をポーリングすることで、長時間実行されるクエリを処理するように設計されています。デフォルトのタイムアウトは 10 分(10 秒間隔で 60 回の再試行)ですが、必要に応じてdbapi.pyファイルで調整できます。
依存関係
httpx: Databricks APIへのHTTPリクエストを行うため
python-dotenv: .env ファイルから環境変数を読み込む
mcp: モデルコンテキストプロトコルライブラリ
asyncio: 非同期操作用
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 gradedqualityFmaintenanceA Model Context Protocol server that enables LLMs to interact with Databricks workspaces through natural language, allowing SQL query execution and job management operations.50
- AlicenseBqualityDmaintenanceA server that implements the Model Completion Protocol (MCP) to allow LLMs to interact with Databricks resources including clusters, jobs, notebooks, and SQL execution through natural language.1148MIT
- AlicenseNot gradedqualityCmaintenanceA Model Context Protocol server that enables AI assistants to interact with Databricks workspaces, allowing them to browse Unity Catalog, query metadata, sample data, and execute SQL queries.MIT
- AlicenseCqualityDmaintenanceA read-only MCP server that enables users to query Databricks SQL, browse metadata, and monitor Delta Lake tables. It also supports tracking Databricks Jobs, DLT Pipelines, and cluster metrics through natural language interfaces.254MIT
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Official Microsoft MCP Server to query Microsoft Entra data using natural language
GibsonAI MCP server: manage your databases with natural language
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/RafaelCartenet/mcp-databricks-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server