loading…
Search for a command to run...
loading…
Enables AI assistants to interact with Hadoop Hue for executing SQL queries using Hive, SparkSQL, or Impala and managing HDFS files. It supports directory brows
Enables AI assistants to interact with Hadoop Hue for executing SQL queries using Hive, SparkSQL, or Impala and managing HDFS files. It supports directory browsing, file transfers, and exporting query results to CSV through the Model Context Protocol.
An MCP (Model Context Protocol) server that exposes HueClientRest functionality, allowing AI assistants to interact with Hadoop Hue for executing SQL queries and managing HDFS files.
This server enables AI assistants (like GitHub Copilot, Claude Desktop, or other MCP-compatible clients) to:
The Model Context Protocol (MCP) is an open standard for connecting AI assistants to external tools and data sources, making them more powerful and context-aware.
Before installing this MCP server, you need:
This project uses the following key dependencies:
uv is a modern, fast Python package manager that we use for dependency management.
On Windows (PowerShell):
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
On macOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
After installation, restart your terminal or add uv to your PATH as instructed by the installer.
Verify installation:
uv --version
# Clone the repository
git clone <your-repo-url>
cd hueclientrest-mpc
# Install dependencies and create virtual environment
uv sync
The uv sync command will:
.venv)pyproject.tomlIf you prefer pip over uv:
pip install -e .
However, uv is strongly recommended for better performance and dependency management.
The server requires the following environment variables to connect to your Hue server:
| Variable | Required | Description |
|---|---|---|
HUE_HOST |
Yes | Hue server URL (e.g., https://hue.example.com) |
HUE_USERNAME |
Yes | Username for Hue authentication |
HUE_PASSWORD |
Yes | Password for Hue authentication |
HUE_VERIFY_SSL |
No | Verify SSL certificates (default: true) |
HUE_SSL_WARNINGS |
No | Show SSL warnings (default: false) |
Option 1: Using .env file (Recommended for local development)
# Create a .env file in the project root
HUE_HOST=https://your-hue-server.com
HUE_USERNAME=your_username
HUE_PASSWORD=your_password
HUE_VERIFY_SSL=true
HUE_SSL_WARNINGS=false
Option 2: System environment variables
On Windows (PowerShell):
$env:HUE_HOST="https://your-hue-server.com"
$env:HUE_USERNAME="your_username"
$env:HUE_PASSWORD="your_password"
On macOS/Linux:
export HUE_HOST="https://your-hue-server.com"
export HUE_USERNAME="your_username"
export HUE_PASSWORD="your_password"
The MCP configuration file location depends on your operating system:
%APPDATA%\Code\User\mcp.jsonC:\Users\<YourUsername>\AppData\Roaming\Code\User\mcp.json~/Library/Application Support/Code/User/mcp.json~/.config/Code/User/mcp.jsonIf the file doesn't exist, create it.
Add the following configuration to your mcp.json file:
{
"mcpServers": {
"hue": {
"command": "uv",
"args": [
"run",
"--directory",
"C:\\Projects\\hueclientrest-mpc",
"hue-mcp-server"
],
"env": {
"HUE_HOST": "https://your-hue-server.com",
"HUE_USERNAME": "your_username",
"HUE_PASSWORD": "your_password",
"HUE_VERIFY_SSL": "true",
"HUE_SSL_WARNINGS": "false"
}
}
}
}
Important Notes:
C:\\Projects\\hueclientrest-mpc with the actual path to your project\\) or forward slashes (/) in pathscommand is uv which will use the uv package manager to run the server@workspace and look for Hue-related capabilitiesOnce configured, you can ask GitHub Copilot to interact with your Hue server:
Example queries:
Issue: MCP server not appearing in Copilot
mcp.json path is correctIssue: Authentication errors
Issue: Command not found
uv --version in terminaluv sync in the project directoryIf uv is not working or not in your PATH, you can use the absolute path to the Python interpreter:
Windows example:
{
"mcpServers": {
"hue": {
"command": "C:\\Projects\\hueclientrest-mpc\\.venv\\Scripts\\python.exe",
"args": ["-m", "hue_mcp_server.server"],
"env": {
"HUE_HOST": "https://your-hue-server.com",
"HUE_USERNAME": "your_username",
"HUE_PASSWORD": "your_password"
}
}
}
}
macOS/Linux example:
{
"mcpServers": {
"hue": {
"command": "/full/path/to/hueclientrest-mpc/.venv/bin/python",
"args": ["-m", "hue_mcp_server.server"],
"env": {
"HUE_HOST": "https://your-hue-server.com",
"HUE_USERNAME": "your_username",
"HUE_PASSWORD": "your_password"
}
}
}
}
If you're using Claude Desktop instead of VS Code, add this to your Claude config (~/.config/claude/claude_desktop_config.json on Mac/Linux or %APPDATA%\Claude\claude_desktop_config.json on Windows):
{
"mcpServers": {
"hue": {
"command": "uv",
"args": ["run", "--directory", "/path/to/hueclientrest-mpc", "hue-mcp-server"],
"env": {
"HUE_HOST": "https://your-hue-server.com",
"HUE_USERNAME": "your_username",
"HUE_PASSWORD": "your_password"
}
}
}
}
Test the server interactively using the MCP inspector:
uv run mcp dev src/hue_mcp_server/server.py
This opens an interactive interface where you can test tools and see requests/responses in real-time.
You can also run the server directly:
# Using the installed script (after uv sync)
uv run hue-mcp-server
# Or via Python module
uv run python -m hue_mcp_server.server
hue_execute_queryExecute a SQL query and return results directly.
Arguments:
- statement: SQL statement to execute
- dialect: 'hive', 'sparksql', or 'impala' (default: 'hive')
- timeout: Max wait time in seconds (default: 300)
- batch_size: Rows per batch (default: 1000)
hue_run_query_to_csvExecute a query and save results to a CSV file.
Arguments:
- statement: SQL statement to execute
- filename: Output CSV filename (default: 'results.csv')
- dialect: SQL dialect (default: 'hive')
- batch_size: Rows per batch (default: 1000)
hue_export_and_downloadExecute INSERT OVERWRITE DIRECTORY and download resulting files.
Arguments:
- statement: SQL with INSERT OVERWRITE DIRECTORY
- hdfs_directory: HDFS output directory
- local_directory: Local download directory (default: '.')
- dialect: SQL dialect (default: 'hive')
- file_pattern: Regex to filter files (optional)
- timeout: Max wait time (default: 300)
hue_list_directoryList contents of an HDFS directory.
Arguments:
- directory_path: HDFS path (e.g., '/user/data')
- page_size: Max items to return (default: 1000)
hue_check_directory_existsCheck if an HDFS directory exists.
Arguments:
- directory_path: HDFS path to check
hue_download_fileDownload a single file from HDFS.
Arguments:
- remote_path: Full HDFS file path
- local_filename: Local filename (optional)
hue_download_directoryDownload all files from an HDFS directory.
Arguments:
- directory_path: HDFS directory path
- local_directory: Local directory (default: '.')
- file_pattern: Regex to filter files (optional)
hue_upload_fileUpload a local file to HDFS.
Arguments:
- local_file_path: Path to local file
- hdfs_destination: HDFS destination directory
MCP is an open protocol that standardizes how AI assistants communicate with external tools and data sources. Think of it as a universal adapter that lets AI assistants "plug into" different services.
Key components:
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ GitHub │ MCP │ Hue MCP │ REST │ Hadoop Hue │
│ Copilot │◄──────►│ Server │◄──────►│ Server │
│ (VS Code) │Protocol│ (This Project) │ API │ │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│
▼
┌──────────────────┐
│ HueClientRest │
│ Library │
└──────────────────┘
What it is: A next-generation Python package and project manager written in Rust.
Why we use it:
Key commands:
uv sync - Install/update dependenciesuv add <package> - Add a new dependencyuv run <command> - Run commands in the virtual environmentuv pip install <package> - Use like pip if neededLearn more: https://docs.astral.sh/uv/
What it is: The official Python SDK for building MCP servers.
Key features:
mcp dev for testing, mcp install for setupIn this project:
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("Hue MCP Server")
@mcp.tool()
def hue_execute_query(statement: str, dialect: str = "hive"):
"""Execute SQL query on Hue"""
# Implementation
What it is: Python client for Hadoop Hue REST API.
Capabilities:
In this project:
from hueclientrest import HueClientREST
client = HueClientREST(host, username, password)
client.login()
result = client.execute_query(statement, dialect)
What it is: Data validation library using Python type hints.
Why we use it:
In this project:
from pydantic import BaseModel, Field
class QueryResult(BaseModel):
rows: List[dict]
columns: List[str]
row_count: int
In VS Code with Copilot:
You: "Execute a Hive query to show the first 10 tables"
Copilot: [Uses hue_execute_query tool]
Result: Returns table list from your Hue server
Query executed:
SELECT database_name, table_name
FROM information_schema.tables
LIMIT 10
In VS Code with Copilot:
You: "List all files in /user/hive/warehouse directory"
Copilot: [Uses hue_list_directory tool]
Result: Shows file names, sizes, and permissions
In VS Code with Copilot:
You: "Query the sales table for 2024 and save to CSV"
Copilot: [Uses hue_run_query_to_csv tool]
Result: Creates sales_2024.csv with query results
Query executed:
SELECT * FROM sales WHERE year = 2024
In VS Code with Copilot:
You: "Check if /user/data/processed exists, if not list /user/data,
then download all CSV files from there"
Copilot:
1. [Uses hue_check_directory_exists]
2. [Uses hue_list_directory]
3. [Uses hue_download_directory with file_pattern=".*\.csv$"]
Result: Downloads all CSV files to local directory
# Clone and install
git clone <your-repo-url>
cd hueclientrest-mpc
uv sync
# Install development dependencies
uv sync --dev
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=hue_mcp_server
# Run specific test file
uv run pytest tests/test_server.py
To add a new MCP tool:
server.py:@mcp.tool()
def hue_new_feature(param: str) -> dict:
"""Description of what this tool does."""
client = get_client()
result = client.some_operation(param)
return {"status": "success", "data": result}
The @mcp.tool() decorator automatically:
Test your tool:
uv run mcp dev src/hue_mcp_server/server.py
Enable verbose logging:
import logging
logging.basicConfig(level=logging.DEBUG)
Test MCP server directly:
# Interactive testing
uv run mcp dev src/hue_mcp_server/server.py
# Check server can start
uv run python -m hue_mcp_server.server
VS Code debugging:
hueclientrest-mpc/
├── .venv/ # Virtual environment (created by uv)
├── pyproject.toml # Project metadata and dependencies
├── README.md # This comprehensive guide
├── .env.example # Example environment variables
├── .gitignore # Git ignore patterns
└── src/
└── hue_mcp_server/
├── __init__.py # Package initialization
└── server.py # MCP server implementation
├── Server setup and configuration
├── Tool definitions (@mcp.tool decorators)
├── Hue client wrapper functions
└── Main entry point
View installed packages:
uv pip list
Add a new dependency:
uv add <package-name>
Update dependencies:
uv sync --upgrade
Remove a dependency:
uv remove <package-name>
Best Practices:
For production environments:
# Always verify SSL certificates
HUE_VERIFY_SSL=true
HUE_SSL_WARNINGS=false
For development/testing (self-signed certificates):
# Only for development!
HUE_VERIFY_SSL=false
HUE_SSL_WARNINGS=false
Solution:
# Windows PowerShell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
# Then restart terminal or add to PATH
Error: requires-python = ">=3.10" but you have Python 3.9
Solution:
# Install Python 3.10+ from python.org
# Or use uv to manage Python versions
uv python install 3.11
uv venv --python 3.11
Checklist:
uv --version)uv sync)Error: "Authentication failed" or "401 Unauthorized"
Solution:
Error: "Query execution timeout"
Solution:
# Increase timeout when calling tools
hue_execute_query(
statement="SELECT * FROM large_table",
timeout=600 # 10 minutes instead of default 5
)
Error: "File or directory not found"
Solution:
/)hue_list_directory to browse available pathshue_execute_query(statement="...", batch_size=5000)
SELECT * FROM large_table LIMIT 1000
INSERT OVERWRITE DIRECTORY '/tmp/export'
SELECT * FROM large_table
Then use hue_export_and_download to retrieve files.
hue_download_directory(
directory_path="/user/data",
file_pattern=".*\\.csv$" # Only CSV files
)
A: Yes! See the "Claude Desktop Integration" section for configuration details.
A: Yes, fully supported on Windows, macOS, and Linux.
A: Any version with REST API support. Tested with Hue 4.x and newer.
A: Each user should run their own MCP server instance with their own credentials.
A:
git pull
uv sync --upgrade
A: Credentials are stored in environment variables or mcp.json. Keep these files secure and never commit them to version control.
Contributions are welcome! Please feel free to submit issues or pull requests.
git clone <your-repo-url>
cd hueclientrest-mpc
uv sync --dev
uv run pytest
uv run pytest --cov=hue_mcp_server
This project uses:
MIT License - See LICENSE file for details
For issues, questions, or feature requests:
Happy querying! 🚀
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"hue-mcp-server": {
"command": "npx",
"args": []
}
}
}