返回顶部
b

byted-bytehouse-mcpByteHouse MCP连接

在本地拉起ByteHouse MCP Server并调用其tools的技能,用于连接ByteHouse数据库查询数据、使用MCP协议与ByteHouse交互、生成数据资产目录和血缘分析。当用户需要连接ByteHouse数据库查询数据、使用MCP协议与ByteHouse交互、生成数据资产目录和血缘分析时,使用此Skill。

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
89
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

byted-bytehouse-mcp

ByteHouse MCP Server 技能

🔵 ByteHouse 品牌标识

「ByteHouse」—— 火山引擎云原生数据仓库,极速、稳定、安全、易用

本技能基于ByteHouse官方MCP Server,提供完整的ByteHouse数据访问能力


描述

在本地拉起ByteHouse MCP Server并调用其工具的技能。

当以下情况时使用此技能:
(1) 需要连接ByteHouse数据库查询数据
(2) 需要使用MCP协议与ByteHouse交互
(3) 用户提到ByteHouse、MCP、查询数据库、看表
(4) 需要生成数据资产目录和血缘分析

📁 文件说明

  • - SKILL.md - 本文件,技能主文档
  • mcpclient.py - MCP客户端模块,用于程序化调用MCP Server
  • testmcpserver.py - MCP Server测试脚本
  • examplemcpusage.py - MCP使用示例
  • querytop10tablesmcp.py - 使用MCP查询Top 10大表
  • testlisttables.py - 测试listtables工具
  • dataassetanalyzer.py - 数据资产和血缘分析工具(新增)
  • startmcpservice.sh - 启动常驻MCP Server服务
  • stopmcpservice.sh - 停止MCP Server服务
  • statusmcpservice.sh - 查看MCP Server状态
  • restartmcp_service.sh - 重启MCP Server服务

前置条件

  • - Python 3.8+
  • uv (已安装在 /root/.local/bin/uv)
  • ByteHouse连接信息(需自行配置)

配置信息

ByteHouse连接配置

json
{
host: ,
port: ,
user: ,
password: ,
secure: true,
verify: true
}

环境变量

在使用前请设置以下环境变量:

bash
export BYTEHOUSE_HOST=
export BYTEHOUSE_PORT=
export BYTEHOUSE_USER=
export BYTEHOUSE_PASSWORD=
export BYTEHOUSE_SECURE=true
export BYTEHOUSE_VERIFY=true
export BYTEHOUSECONNECTTIMEOUT=30
export BYTEHOUSESENDRECEIVE_TIMEOUT=30

🎯 ByteHouse MCP Server 工具

序号工具名称功能描述
1listdatabases列出所有数据库
2
listtables | 列出指定数据库中的所有表 | | 3 | runselectquery | 运行SELECT查询 | | 4 | rundmlddl_query | 运行DML/DDL查询 | | 5 | getbytehousetableenginedoc | 获取ByteHouse表引擎文档 |

🚀 快速开始

方法1: 测试MCP Server(推荐先测试)

bash
cd /root/.openclaw/workspace/skills/bytehouse-mcp

先设置环境变量,然后运行


uv run testmcpserver.py

这会:

  1. 1. 自动安装ByteHouse MCP Server
  2. 启动MCP Server
  3. 列出所有可用的工具
  4. 尝试调用第一个工具

方法2: 列出数据库中的表

bash
cd /root/.openclaw/workspace/skills/bytehouse-mcp

先设置环境变量,然后运行


uv run testlisttables.py

方法3: 使用MCP查询Top 10大表

bash
cd /root/.openclaw/workspace/skills/bytehouse-mcp

先设置环境变量,然后运行


uv run querytop10tables_mcp.py

方法4: 生成数据资产和血缘分析(新增)

bash
cd /root/.openclaw/workspace/skills/bytehouse-mcp

先设置环境变量,然后运行


uv run dataassetanalyzer.py

这会:

  1. 1. 获取数据库的完整模式
  2. 生成数据资产目录
  3. 生成血缘分析报告
  4. 保存JSON文件到 output/ 目录

输出内容包括:

  • - 数据库模式(所有表和字段)
  • 数据资产目录(表统计、标签、引擎分布)
  • 血缘分析(表关系、列相似性)

方法5: 启动常驻MCP Server服务

bash
cd /root/.openclaw/workspace/skills/bytehouse-mcp

先在脚本中配置环境变量,然后运行


./startmcpservice.sh

这会:

  1. 1. 在后台启动MCP Server
  2. 保存PID到 mcpserver.pid
  3. 写入日志到 logs/mcpserver_*.log

方法6: 查看MCP Server状态

bash
./statusmcpservice.sh

方法7: 停止MCP Server

bash
./stopmcpservice.sh

方法8: 重启MCP Server

bash
./restartmcpservice.sh

💻 数据资产和血缘分析(新增)

功能说明

dataassetanalyzer.py 提供以下功能:

  1. 1. 完整模式获取
- 获取指定数据库的所有表 - 获取每张表的所有字段 - 提取表引擎、注释等元数据
  1. 2. 数据资产目录生成
- 表统计(总表数、总列数) - 引擎分布统计 - 自动标签生成 - 表资产详情
  1. 3. 血缘分析
- 表关系识别(分布式 → 本地) - 列相似性分析 - 关系可视化

使用示例

python
#!/usr/bin/env python3

/// script


dependencies = [


mcp>=1.0.0,


]


///

import asyncio
from dataassetanalyzer import DataAssetAnalyzer

async def main():
analyzer = DataAssetAnalyzer()
await analyzer.connect()

# 分析数据库
result = await analyzer.analyze_database(default)

# result 包含:
# - schema: 完整的数据库模式
# - catalog: 数据资产目录
# - lineage: 血缘分析
# - files: 生成的文件路径

asyncio.run(main())

输出文件

分析完成后会在 output/ 目录生成以下文件:

  1. 1. schema{database}{timestamp}.json - 完整的数据库模式
  2. catalog{database}{timestamp}.json - 数据资产目录
  3. lineage{database}{timestamp}.json - 血缘分析报告

💻 程序化使用MCP客户端

使用mcp_client.py模块

python
#!/usr/bin/env python3

/// script


dependencies = [


mcp>=1.0.0,


]


///

import asyncio
from mcp_client import ByteHouseMCPClient

async def main():
async with ByteHouseMCPClient() as client:
await client.connect()

# 1. 列出所有工具
tools = await client.list_tools()
print(可用的工具:, [t[name] for t in tools])

# 2. 调用工具
# result = await client.calltool(toolname, {param: value})
# print(result)

asyncio.run(main())

直接使用MCP SDK

python
#!/usr/bin/env python3

/// script


dependencies = [


mcp>=1.0.0,


]


///

import asyncio
import os
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client

async def main():
# 设置环境变量(请自行配置)
env = os.environ.copy()
env.update({
BYTEHOUSE_HOST: ,
BYTEHOUSE_PORT: ,
BYTEHOUSE_USER: ,
BYTEHOUSE_PASSWORD: ,
BYTEHOUSE_SECURE: true,
BYTEHOUSE_VERIFY: true,
})

# MCP Server参数
server_params = StdioServerParameters(
command=/root/.local/bin/uvx,
args=[
--from,
git+https://github.com/volcengine/mcp-server@main#subdirectory=server

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 byted-bytehouse-mcp-1776006390 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 byted-bytehouse-mcp-1776006390 技能

通过命令行安装

skillhub install byted-bytehouse-mcp-1776006390

下载

⬇ 下载 byted-bytehouse-mcp v1.0.0(免费)

文件大小: 19.38 KB | 发布时间: 2026-4-13 09:36

v1.0.0 最新 2026-4-13 09:36
byted-bytehouse-mcp v1.0.0 – Initial Release

- Provides tools for local setup and management of ByteHouse MCP Server, supporting connection, query, and data asset analysis for ByteHouse.
- Includes new support for automated data asset catalog and lineage analysis via `data_asset_analyzer.py`.
- Offers tools to list databases and tables, run SELECT/DML/DDL queries, and retrieve ByteHouse table engine docs.
- Supplies bash scripts for starting, stopping, checking status, and restarting the MCP Server.
- Example scripts provided for common database operations and MCP client usage.
- Requires pre-configured environment variables and Python 3.8+.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部