返回市场
克鲁德拉-MCP

克鲁德拉-MCP

作者:genai-works-org6 星标更新:2025-07-10

项目介绍

Iceberg MCP Server - 安装指南

包含支持HTTP传输的Iceberg MCP Server的完整安装说明。

预备条件

  • Python 3.10+
  • 访问Cloudera Data Platform(带有Impala)
  • 有效的Cloudera凭据
  • uv 包管理器(推荐)或pip

安装UV(如果尚未安装)

# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

# 或通过pip安装
pip install uv

安装

第一步:克隆仓库

git clone https://github.com/genai-works-org/cloudera-mcp
cd cloudera-m

第二步:安装依赖项

# 同步现有项目依赖项
uv sync

# 在可编辑模式下安装项目
uv pip install -e .

配置

第三步:创建环境配置

在项目根目录中创建一个.env文件:

# 使用您的Cloudera凭据创建.env文件
cat > .env << EOF
# Cloudera Impala 配置
IMPALA_HOST=your-coordinator-host.cloudera.site
IMPALA_PORT=443
IMPALA_USER=your-username
IMPALA_PASSWORD=your-password
IMPALA_DATABASE=default
IMPALA_AUTH_MECHANISM=LDAP
IMPALA_USE_HTTP_TRANSPORT=true
IMPALA_HTTP_PATH=cliservice
IMPALA_USE_SSL=true

EOF

第四步:更新配置值

使用实际凭据编辑.env文件:

对于Cloudera Data Platform:

  • IMPALA_HOST: 您的Cloudera协调主机名
  • IMPALA_USER: 您的Cloudera用户名
  • IMPALA_PASSWORD: 您的Cloudera密码
  • IMPALA_AUTH_MECHANISM: 对于CDP通常为LDAP

从JDBC连接字符串示例:

jdbc:impala://coordinator-xyz123.dw-xyz123.cloudera.site:443/default;AuthMech=3;transportMode=http;httpPath=cliservice;ssl=1;UID=myuser;PWD=mypass

转换为:

IMPALA_HOST=coordinator-xyz123.dw-xyz123.cloudera.site
IMPALA_PORT=443
IMPALA_USER=myuser
IMPALA_PASSWORD=mypass
IMPALA_AUTH_MECHANISM=LDAP 

验证

第六步:测试数据库连接

# 测试数据库连接
uv run python -c "
import os
from dotenv import load_dotenv
load_dotenv()
from cloudera_mcp.tools.impala_tools import get_db_connection

try:
    conn = get_db_connection()
    print('数据库连接成功')
    conn.close()
except Exception as e:
    print(f'数据库连接失败: {e}')
"

第七步:启动MCP服务器

# 启动服务器
uv run python src/cloudera_mcp/server.py

预期输出:

正在通过Impala在端口8888上启动Iceberg MCP Server
服务器将在以下地址可用: http://localhost:8888/
INFO:     已启动服务器进程 [46517]
INFO:     正在等待应用程序启动。
[07/09/25 01:23:53] INFO     StreamableHTTP会话管理器已启动                                                                                                   streamable_http_manager.py:112
INFO:     应用程序启动完成。
INFO:     Uvicorn正在运行于 http://127.0.0.1:8888 (按CTRL+C退出)