databricks-genie-MCP is a Model Context Protocol (MCP) server used to connect to the Databricks Genie API. Through it, large language models can ask natural language questions, run SQL queries, and interact with Databricks' conversational agent.
The main capabilities include: listing the Genie spaces available in a Databricks workspace (currently manually or using the resource method); retrieving metadata for a specific Genie space (title, description); starting a new Genie conversation with a natural language question; following up in an ongoing Genie conversation; retrieving SQL and result tables in a structured format.
The provided MCP tools are as follows: get_genie_space_id() lists the available Genie space IDs and titles; get_space_info(space_id: str) retrieves the title and description of a Genie space; ask_genie(space_id: str, question: str) starts a new Genie conversation and retrieves the results; follow_up(space_id: str, conversation_id: str, question: str) continues an existing Genie conversation.
Prerequisites: a Databricks workspace is required, along with a personal access token, the Genie API enabled, and permission to access Genie spaces and run queries. Usage is to clone the repository, create and activate a virtual environment (recommended), install dependencies, and create a .env file in the root directory containing the corresponding variables.
It is particularly important to note that the materials explain that the Databricks Genie API currently does not provide a public endpoint to list all available space IDs and titles, so a workaround is needed: manually add the Genie space IDs and their titles in the get_genie_space_id() function in main.py.
To test the server, you can use inspector (optional but recommended), or you can directly build and run Docker to test. When using it with Claude Desktop, you need to download Claude Desktop, run the installation command in the project directory, and after installation is complete, open Desk in Claudetop, click Resources → Add Resource, select the Genie MCP Server, and you can begin talking to your data in natural language.
Steps to obtain Databricks credentials: Host is the Databricks instance URL (for example your-instance.cloud.databricks.com), and must not include https://;在 In the Databricks workspace, click your username in the upper right corner → User Settings, and under the Developer tab click Manage for Access tokens, generate a new token and copy it. When running the server, the Genie MCP server will be started on the stdio transport for LLM interaction.
Troubleshooting: for an invalid host, make sure the host does not include https://;令牌错误时确认个人访问令牌有效且有权访问 Genie; for timeouts, check whether the Genie space is accessible and whether it is idle or expired; when no data is returned, make sure the query is valid for the selected space.
Security considerations: keep the .env file secure and never commit it to version control; use least-privilege tokens with expiration times whenever possible; unless authenticated, avoid exposing this server to public-facing environments.