
byted-bytehouse-mcp
在本地拉起ByteHouse MCP Server并调用其tools的技能,用于连接ByteHouse数据库查询数据、使用MCP协议与ByteHouse交互、生成数据资产目录和血缘分析。当用户需要连接ByteHouse数据库查询数据、使用MCP协议与ByteHouse交互、生成数据资产目录和血缘分析时,使用此Skill。
- Installs
- 45
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/bytedance/agentkit-samples --skill byted-bytehouse-mcp- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads byted-bytehouse-mcp automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
ByteHouse MCP Server Skill
🔵 ByteHouse 品牌标识
「ByteHouse」—— 火山引擎云原生数据仓库,极速、稳定、安全、易用
本Skill基于ByteHouse官方MCP Server,提供完整的ByteHouse数据访问能力
描述
在本地拉起ByteHouse MCP Server并调用其tools的技能。
当以下情况时使用此 Skill: (1) 需要连接ByteHouse数据库查询数据 (2) 需要使用MCP协议与ByteHouse交互 (3) 用户提到"ByteHouse"、"MCP"、"查询数据库"、"看表" (4) 需要生成数据资产目录和血缘分析
🎯 ByteHouse MCP Server Tools
| 序号 | Tool名称 | 功能描述 |
|---|---|---|
| 1 | list_databases | 列出所有数据库 |
| 2 | list_tables | 列出指定数据库中的所有表 |
| 3 | run_select_query | 运行SELECT查询 |
| 4 | run_dml_ddl_query | 运行DML/DDL查询 |
| 5 | get_bytehouse_table_engine_doc | 获取ByteHouse表引擎文档 |
📁 文件说明
- SKILL.md - 本文件,技能主文档
- mcp_client.py - MCP客户端模块,用于程序化调用MCP Server
- test_mcp_server.py - MCP Server测试脚本
- example_mcp_usage.py - MCP使用示例
- query_top10_tables_mcp.py - 使用MCP查询Top 10大表
- test_list_tables.py - 测试list_tables tool
- data_asset_analyzer.py - 数据资产和血缘分析工具(新增)
- start_mcp_service.sh - 启动常驻MCP Server服务
- stop_mcp_service.sh - 停止MCP Server服务
- status_mcp_service.sh - 查看MCP Server状态
- restart_mcp_service.sh - 重启MCP Server服务
配置说明
配置保存在 ~/.bytehouse_config.json ,如果该文件存在且非空,则直接使用文件中的配置。如果不存在,则让用户提供ByteHouse连接信息( 把这个文档也发给客户,文档里面介绍了如何获取主机地址和密码:https://www.volcengine.com/docs/6517/1121919?lang=zh )。用户提供信息后,保存到json文件,避免重复向用户请求连接信息。当用户切换ByteHouse集群时,一并修改该文件。
{
"BYTEHOUSE_HOST": "<ByteHouse-host>",
"BYTEHOUSE_PORT": "8123",
"BYTEHOUSE_USER": "bytehouse",
"BYTEHOUSE_PASSWORD": "<ByteHouse-password>",
"BYTEHOUSE_SECURE": true,
"BYTEHOUSE_VERIFY": true,
"BH_ARK_API_KEY": "<火山引擎方舟API密钥>",
"BH_ARK_BASE_URL": "https://ark.cn-beijing.volces.com/api/v3",
"BH_EMBEDDING_MODEL": "doubao-embedding-vision-251215"
}
其中BYTEHOUSE_HOST(主机地址)和BYTEHOUSE_PASSWORD(密码)必须由用户提供。BH_ARK_API_KEY为可选配置,仅在embedding时使用,用户初次使用时可忽略。其余配置固定。
前置条件
- Python 3.8+
- uv (已安装在
/root/.local/bin/uv) - ByteHouse连接信息(需自行配置)
🚀 快速开始
方法1: 测试MCP Server(推荐先测试)
# 从配置文件读取配置,导出到环境变量
source scripts/export_config.sh
# 测试mcp server
uv run scripts/test_mcp_server.py
这会:
- 自动安装ByteHouse MCP Server
- 启动MCP Server
- 列出所有可用的tools
- 尝试调用第一个tool
方法2: 列出数据库中的表
cd /root/.openclaw/workspace/skills/bytehouse-mcp
# 先设置环境变量,然后运行
uv run test_list_tables.py
方法3: 使用MCP查询Top 10大表
cd /root/.openclaw/workspace/skills/bytehouse-mcp
# 先设置环境变量,然后运行
uv run query_top10_tables_mcp.py
方法4: 生成数据资产和血缘分析(新增)
cd /root/.openclaw/workspace/skills/bytehouse-mcp
# 先设置环境变量,然后运行
uv run data_asset_analyzer.py
这会:
- 获取数据库的完整schema
- 生成数据资产目录
- 生成血缘分析报告
- 保存JSON文件到
output/目录
输出内容包括:
- 数据库schema(所有表和字段)
- 数据资产目录(表统计、标签、引擎分布)
- 血缘分析(表关系、列相似性)
方法5: 启动常驻MCP Server服务
cd /root/.openclaw/workspace/skills/bytehouse-mcp
# 先在脚本中配置环境变量,然后运行
./start_mcp_service.sh
这会:
- 在后台启动MCP Server
- 保存PID到
mcp_server.pid - 写入日志到
logs/mcp_server_*.log
方法6: 查看MCP Server状态
./status_mcp_service.sh
方法7: 停止MCP Server
./stop_mcp_service.sh
方法8: 重启MCP Server
./restart_mcp_service.sh
💻 数据资产和血缘分析(新增)
功能说明
data_asset_analyzer.py 提供以下功能:
-
完整Schema获取
- 获取指定数据库的所有表
- 获取每张表的所有字段
- 提取表引擎、注释等元数据
-
数据资产目录生成
- 表统计(总表数、总列数)
- 引擎分布统计
- 自动标签生成
- 表资产详情
-
血缘分析
- 表关系识别(Distributed → Local)
- 列相似性分析
- 关系可视化
使用示例
#!/usr/bin/env python3
# /// script
# dependencies = [
# "mcp>=1.0.0",
# ]
# ///
import asyncio
from data_asset_analyzer import DataAssetAnalyzer
async def main():
analyzer = DataAssetAnalyzer()
await analyzer.connect()
# 分析数据库
result = await analyzer.analyze_database("default")
# result 包含:
# - schema: 完整的数据库schema
# - catalog: 数据资产目录
# - lineage: 血缘分析
# - files: 生成的文件路径
asyncio.run(main())
输出文件
分析完成后会在 output/ 目录生成以下文件:
- schema_{database}_{timestamp}.json - 完整的数据库schema
- catalog_{database}_{timestamp}.json - 数据资产目录
- lineage_{database}_{timestamp}.json - 血缘分析报告
💻 程序化使用MCP Client
使用mcp_client.py模块
#!/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
tools = await client.list_tools()
print("可用的tools:", [t['name'] for t in tools])
# 2. 调用tool
# result = await client.call_tool("tool_name", {"param": "value"})
# print(result)
asyncio.run(main())
直接使用MCP SDK
#!/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-host>',
'BYTEHOUSE_PORT': '<ByteHouse-port>',
'BYTEHOUSE_USER': '<ByteHouse-user>',
'BYTEHOUSE_PASSWORD': '<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/mcp_server_bytehouse',
'mcp_bytehouse',
'-t',
'stdio'
],
env=env
)
# 启动MCP Server并连接
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
# 列出tools
result = await session.list_tools()
print("Tools:", [t.name for t in result.tools])
# 调用tool
# call_result = await session.call_tool("tool_name", {"param": "value"})
asyncio.run(main())
🔧 服务管理
启动服务
# 先配置环境变量,然后运行
./start_mcp_service.sh
查看状态
./status_mcp_service.sh
查看日志
# 查看最新日志
tail -f logs/mcp_server_*.log
# 查看特定日志文件
tail -f logs/mcp_server_20260312_184500.log
停止服务
./stop_mcp_service.sh
重启服务
./restart_mcp_service.sh
💻 使用MCP Tools示例
示例1: 列出所有数据库
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-host>',
'BYTEHOUSE_PORT': '<ByteHouse-port>',
'BYTEHOUSE_USER': '<ByteHouse-user>',
'BYTEHOUSE_PASSWORD': '<ByteHouse-password>',
'BYTEHOUSE_SECURE': 'true',
'BYTEHOUSE_VERIFY': 'true',
})
server_params = StdioServerParameters(
command='/root/.local/bin/uvx',
args=[
'--from',
'git+https://github.com/volcengine/mcp-server@main#subdirectory=server/mcp_server_bytehouse',
'mcp_bytehouse',
'-t',
'stdio'
],
env=env
)
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
# 调用list_databases
result = await session.call_tool("list_databases", {})
for content in result.content:
if content.type == 'text':
print(content.text)
asyncio.run(main())
示例2: 列出数据库中的表
# 调用list_tables
result = await session.call_tool("list_tables", {"database": "default"})
示例3: 运行SELECT查询
# 调用run_select_query
sql = "SELECT * FROM default.conversation_feedback LIMIT 10"
result = await session.call_tool("run_select_query", {"query": sql})
示例4: 查询Top 10大表
# 查询Top 10大表
sql = """
SELECT
database,
table,
sum(bytes) as total_bytes,
sum(rows) as total_rows
FROM system.parts
WHERE active = 1
GROUP BY database, table
ORDER BY total_bytes DESC
LIMIT 10
"""
result = await session.call_tool("run_select_query", {"query": sql})
FAQ
What does the byted-bytehouse-mcp skill do?
在本地拉起ByteHouse MCP Server并调用其tools的技能,用于连接ByteHouse数据库查询数据、使用MCP协议与ByteHouse交互、生成数据资产目录和血缘分析。当用户需要连接ByteHouse数据库查询数据、使用MCP协议与ByteHouse交互、生成数据资产目录和血缘分析时,使用此Skill。
How do I install byted-bytehouse-mcp?
Run npx skills add https://github.com/bytedance/agentkit-samples --skill byted-bytehouse-mcp in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/byted-bytehouse-mcp/ (personal) or .claude/skills/byted-bytehouse-mcp/ (project).
Which AI agents can use byted-bytehouse-mcp?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is byted-bytehouse-mcp safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains byted-bytehouse-mcp?
It is published by bytedance in bytedance/agentkit-samples. It has 45 recorded installs.
More from bytedance/agentkit-samples
byted-web-search
bytedance/agentkit-samples
火山引擎联网搜索 API,返回网页/图片结果。联网搜索场景优先使用本 skill。触发词包括:查/搜/找、真的吗/靠谱吗/确认/核实、最近/今天/最新/近期、出处/来源/链接、有什么/有哪些/推荐、价格/政策/汇率/行情、对比/区别/哪个好、听说/据说/不太确定、热搜/热门/火、帮我看/了解一下、求证/辟谣、值不值得/该不该。任务依赖在线事实或时效性时优先使用。若回答可能依赖外部事实,优先调用本 skill 再作答。支持 API Key / AK/SK。
byted-seedream-image-generate
bytedance/agentkit-samples
Open the skill to read its SKILL.md instructions.
byted-las-video-edit
bytedance/agentkit-samples
Open the skill to read its SKILL.md instructions.
byted-seedance-video-generate
bytedance/agentkit-samples
Open the skill to read its SKILL.md instructions.
byted-text-to-speech
bytedance/agentkit-samples
Open the skill to read its SKILL.md instructions.
byted-las-pdf-parse-doubao
bytedance/agentkit-samples
Open the skill to read its SKILL.md instructions.
Popular ai & agents skills
google-agents-cli-publish
google/agents-cli
This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).
google-agents-cli-eval
google/agents-cli
This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).
skill-creator
anthropics/skills
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
codex-pet
prime-skills/runcomfy-agent-skills
Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.
full-output-enforcement
leonxlnx/taste-skill
Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.
executing-plans
obra/superpowers
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available