dremio-python-mcp
The Dremio Model-Context Protocol (MCP) server provides a standardized method to interact with Dremio databases, offering tools for listing catalogs, schemas, and executing SQL queries. It is designed to simplify data access and management while ensuring security through validation and authentication features.
Dremio Model-Context Protocol (MCP)
This project implements a Model-Context Protocol (MCP) server for Dremio. It provides a standardized way to interact with Dremio databases through the MCP.
Features
Resources
Exposes Dremio data through Resources:
dremio://catalogs
- Lists all catalogsdremio://schemas/{catalog}
- Lists all schemas in a catalogdremio://tables/{catalog}/{schema}
- Lists all tables in a schemadremio://schema/{table_name}
- Gets schema information for a table
Tools
-
list_catalogs
- Lists all available catalogs in Dremio
- Usage:
list_catalogs()
-
list_schemas
- Lists all schemas in a specific catalog
- Usage:
list_schemas("catalog_name")
-
list_tables
- Lists all tables in a specific schema
- Usage:
list_tables("catalog_name", "schema_name")
-
execute_sql
- Executes a SQL query against Dremio
- Returns results in a structured format with metadata
- Usage:
execute_sql("SELECT * FROM catalog.schema.table LIMIT 10")
Requirements
- Python 3.10+
- Dremio instance (Cloud or Software)
- PyArrow with Flight support
Installation
Using pip
pip install -e .
Using uv (recommended)
# Install uv if you don't have it
curl -sSf https://astral.sh/uv/install.sh | bash
# Install the package
uv pip install -e .
Configuration
Create a config.yaml
file in the root directory with the following configuration:
# Dremio connection settings
dremio:
# Connection type: 'software' for Dremio Software or 'cloud' for Dremio Cloud
type: software
# Dremio Software connection details
software:
hostname: localhost
port: 32010
username: your_username
password: your_password
use_ssl: false
# Query settings
query:
# Maximum number of rows to return in a query result
max_rows: 10000
# Maximum number of columns to return in schema request
max_columns: 1000
# Timeout in seconds for query execution
timeout: 300
Environment Variables
You can also configure the server using environment variables:
DREMIO_HOSTNAME=localhost
DREMIO_PORT=32010
DREMIO_USERNAME=your_username
DREMIO_PASSWORD=your_password
DREMIO_USE_SSL=false
For Dremio Cloud:
DREMIO_TYPE=cloud
DREMIO_ENDPOINT=data.dremio.cloud
DREMIO_PAT_TOKEN=your_personal_access_token
Usage
Running the Server
# If installed from package
mcp-dremio-server
# Or run directly
python run_mcp_server.py
Integration with Claude or Other MCP Clients
Add the following configuration to your MCP client settings:
MacOS
// ~/Library/Application\ Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"dremio_service": {
"command": "/Users/USERNAME/.local/bin/uv",
"args": [
"--directory",
"/Users/USERNAME/PycharmProjects/dremio-python-mcp",
"run",
"run_mcp_server.py"
]
}
}
}
Windows
// %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"dremio-mcp": {
"command": "mcp-dremio-server",
"args": []
}
}
}
Example Usage
Listing Catalogs and Schemas
// List all catalogs
list_catalogs()
// List schemas in a catalog
list_schemas("my_catalog")
// List tables in a schema
list_tables("my_catalog", "my_schema")
Executing SQL Queries
// Execute a query
results = execute_sql("SELECT * FROM my_catalog.my_schema.my_table LIMIT 10")
Security Features
- SQL Validation: Prevents execution of non-read-only queries
- Input Validation: Prevents SQL injection via table/schema names
- TLS Support: Secure communication with Dremio
- Authentication: Support for username/password and token authentication
Debugging
Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, use the MCP Inspector:
npx @modelcontextprotocol/inspector mcp-dremio-server
Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.
License
This project is licensed under the MIT License - see the LICENSE file for details.