
CUBRID数据库的模型上下文协议(MCP)服务器——使LLM能够通过pycubrid检查模式并执行只读查询。
概览
一个用于CUBRID的模型上下文协议服务器,使LLM能够安全地检查模式并通过pycubrid执行只读查询。 模式元数据也作为只读MCP资源公开,因此客户端无需工具调用即可发现和读取模式上下文。资源重复使用与工具相同的只读目录查询——无需额外的数据访问或写入面。 两者都返回application/json。{table}中的表名通过URI模板匹配进行百分比解码;未知表或系统表会触发资源读取错误,与describe_table工具匹配。 服务器还会暴露一小部分——可重用、有引导的常见检查任务起点。提示符是:每个提示返回文本,告诉客户端调用哪些现有只读工具及其顺序。它们从不触及数据库、执行SQL,也不会添加任何新的数据访问面,你传递的任何参数都会被隔离,严格作为不可信数据处理。
概述(AI 翻译)
一个用于CUBRID的模型上下文协议服务器,使LLM能够安全地检查模式并通过pycubrid执行只读查询。
真实MCP标准会话的终端录音(演示/mcp_demo.py,带演示/record_demo.sh录制)。
从这里开始
你是CUBRID还是MCP的新手?请按照快速入门指南操作。它 建立一个一次性的本地CUBRID实验室,准备样本表和专用实验室 只读账户,连接一个MCP客户端(一个简短的Python脚本),并运行 第一个查询,展示每个结果的含义以及如何清理。各部分 以下是配置、工具和客户端设置的参考资料。
特色
| 工具 | 描述 |
|---|---|
all_table_names |
列出数据库中的每个用户表 |
filter_table_names |
对表名进行子串搜索 |
schema_definitions |
列类型、可空性、默认值和主键信息 |
describe_table |
完整元数据:列、主键和索引在一个调用中 |
list_indexes |
带有键列和标志的表索引 |
explain_query |
执行计划/跟踪 SELECT/WITH(通过CUBRID SHOW TRACE) |
table_row_counts |
COUNT(*) 对于一个或多个表 |
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
cubrid-mcp-server
A Model Context Protocol server for CUBRID, enabling LLMs to safely inspect schemas and execute read-only queries via pycubrid.
Terminal recording of a real MCP stdio session (demos/mcp_demo.py, recorded with demos/record_demo.sh).
Start here
New to CUBRID or to MCP? Follow the Quick Start guide. It starts a disposable local CUBRID lab, prepares a sample table and a dedicated read-only account, connects one MCP client (a short Python script) and runs a first query, showing what each result means and how to clean up. The sections below are the reference for configuration, tools and client setup.
Features
| Tool | Description |
|---|---|
all_table_names |
List every user table in the database |
filter_table_names |
Substring search over table names |
schema_definitions |
Column types, nullability, defaults, and primary key info |
describe_table |
Full metadata: columns, primary key, and indexes in one call |
list_indexes |
Indexes for a table with key columns and flags |
explain_query |
Execution plan/trace for a SELECT/WITH (via CUBRID SHOW TRACE) |
table_row_counts |
COUNT(*) for one or many tables |
list_serials |
CUBRID SERIAL sequences with current value and bounds |
list_class_hierarchy |
CUBRID CLASS inheritance relationships |
execute_query |
Run read-only SQL with automatic output truncation |
health_check |
Verify database connectivity on demand |
execute_write |
Run a single INSERT/UPDATE/DELETE in an atomic transaction (only registered when opt-in write mode is enabled) |
Resources
Schema metadata is also exposed as read-only MCP Resources, so clients can discover and read schema context without a tool call. Resources reuse the same read-only catalog queries as the tools — no additional data access or write surface.
| Resource URI | MIME type | Description |
|---|
安装
uvx cubrid-mcp-server配置
{
"mcpServers": {
"cubrid": {
"command": "uvx",
"args": ["cubrid-mcp-server"],
"env": {
"CUBRID_HOST": "localhost",
"CUBRID_USER": "readonly_user",
"CUBRID_PASSWORD": "secret",
"CUBRID_DATABASE": "mydb"
}
}
}
}