Databricks MCP Server
Databricks MCP 服务器
一个用于 Databricks 的模型完成协议 (MCP) 服务器,可通过 MCP 协议访问 Databricks 功能。这使得基于 LLM 的工具能够与 Databricks 集群、作业、笔记本等进行交互。
特征
MCP 协议支持:实现 MCP 协议以允许 LLM 与 Databricks 交互
Databricks API 集成:提供对 Databricks REST API 功能的访问
工具注册:将 Databricks 功能公开为 MCP 工具
异步支持:使用 asyncio 构建,可实现高效运行
Related MCP server: Databricks MCP Server
可用工具
Databricks MCP 服务器公开以下工具:
list_clusters :列出所有 Databricks 集群
create_cluster :创建一个新的 Databricks 集群
终止Databricks 集群
get_cluster :获取有关特定 Databricks 集群的信息
start_cluster :启动已终止的 Databricks 集群
list_jobs :列出所有 Databricks 作业
run_job :运行 Databricks 作业
list_notebooks :列出工作区目录中的笔记本
export_notebook :从工作区导出笔记本
list_files :列出 DBFS 路径中的文件和目录
执行SQL 语句
安装
先决条件
Python 3.10 或更高版本
uv包管理器(推荐用于 MCP 服务器)
设置
如果尚未安装
uv,请安装它:# MacOS/Linux curl -LsSf https://astral.sh/uv/install.sh | sh # Windows (in PowerShell) irm https://astral.sh/uv/install.ps1 | iex安装后重新启动终端。
克隆存储库:
git clone https://github.com/JustTryAI/databricks-mcp-server.git cd databricks-mcp-server使用
uv设置项目:# Create and activate virtual environment uv venv # On Windows .\.venv\Scripts\activate # On Linux/Mac source .venv/bin/activate # Install dependencies in development mode uv pip install -e . # Install development dependencies uv pip install -e ".[dev]"设置环境变量:
# Windows set DATABRICKS_HOST=https://your-databricks-instance.azuredatabricks.net set DATABRICKS_TOKEN=your-personal-access-token # Linux/Mac export DATABRICKS_HOST=https://your-databricks-instance.azuredatabricks.net export DATABRICKS_TOKEN=your-personal-access-token您还可以基于
.env.example模板创建.env文件。
运行 MCP 服务器
要启动 MCP 服务器,请运行:
# Windows
.\start_mcp_server.ps1
# Linux/Mac
./start_mcp_server.sh这些包装脚本将执行位于scripts目录中的实际服务器脚本。服务器将启动并准备好接受 MCP 协议连接。
您也可以直接从脚本目录运行服务器脚本:
# Windows
.\scripts\start_mcp_server.ps1
# Linux/Mac
./scripts/start_mcp_server.sh查询 Databricks 资源
该存储库包含用于快速查看 Databricks 资源的实用程序脚本:
# View all clusters
uv run scripts/show_clusters.py
# View all notebooks
uv run scripts/show_notebooks.py项目结构
databricks-mcp-server/
├── src/ # Source code
│ ├── __init__.py # Makes src a package
│ ├── __main__.py # Main entry point for the package
│ ├── main.py # Entry point for the MCP server
│ ├── api/ # Databricks API clients
│ ├── core/ # Core functionality
│ ├── server/ # Server implementation
│ │ ├── databricks_mcp_server.py # Main MCP server
│ │ └── app.py # FastAPI app for tests
│ └── cli/ # Command-line interface
├── tests/ # Test directory
├── scripts/ # Helper scripts
│ ├── start_mcp_server.ps1 # Server startup script (Windows)
│ ├── run_tests.ps1 # Test runner script
│ ├── show_clusters.py # Script to show clusters
│ └── show_notebooks.py # Script to show notebooks
├── examples/ # Example usage
├── docs/ # Documentation
└── pyproject.toml # Project configuration请参阅project_structure.md来了解项目结构的更详细视图。
发展
代码标准
Python 代码遵循 PEP 8 风格指南,每行最大长度为 100 个字符
使用 4 个空格缩进(不使用制表符)
对字符串使用双引号
所有类、方法和函数都应该有 Google 风格的文档字符串
除测试外,所有代码都需要类型提示
代码检查
该项目使用以下 linting 工具:
# Run all linters
uv run pylint src/ tests/
uv run flake8 src/ tests/
uv run mypy src/测试
该项目使用 pytest 进行测试。要运行测试:
# Run all tests with our convenient script
.\scripts\run_tests.ps1
# Run with coverage report
.\scripts\run_tests.ps1 -Coverage
# Run specific tests with verbose output
.\scripts\run_tests.ps1 -Verbose -Coverage tests/test_clusters.py您还可以直接使用 pytest 运行测试:
# Run all tests
uv run pytest tests/
# Run with coverage report
uv run pytest --cov=src tests/ --cov-report=term-missing该项目的目标是最低代码覆盖率达到 80%。
文档
API 文档是使用 Sphinx 生成的,可以在
docs/api目录中找到所有代码都包含 Google 风格的文档字符串
请参阅
examples/目录以获取使用示例
示例
查看examples/目录以获取用法示例。要运行示例,请执行以下操作:
# Run example scripts with uv
uv run examples/direct_usage.py
uv run examples/mcp_client_usage.py贡献
欢迎贡献代码!欢迎提交 Pull 请求。
确保您的代码遵循项目的编码标准
为任何新功能添加测试
根据需要更新文档
提交前验证所有测试均已通过
执照
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。
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
- Alicense-qualityCmaintenanceThis is a Model Context Protocol (MCP) server for executing SQL queries against Databricks using the Statement Execution API. It enables AI assistants to directly query Databricks data warehouses, analyze database schemas, and retrieve query results in a structured format42MIT
- Flicense-qualityFmaintenanceA Model Context Protocol server that enables LLMs to interact with Databricks workspaces through natural language, allowing SQL query execution and job management operations.50
- Alicense-qualityDmaintenanceA server that provides tools to interact with Databricks for cluster, job, notebook, DBFS, and SQL management through natural language interfaces like Claude-Desktop and Cursor.GPL 3.0
- AlicenseBqualityDmaintenanceA fixed Model Completion Protocol (MCP) server that enables LLMs like Claude Code to interact with Databricks functionality including clusters, jobs, notebooks, and SQL execution through natural language commands.195MIT
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server for AI dialogue using various LLM models via AceDataCloud
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
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/JustTryAI/databricks-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server