cubrid-mcp-server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@cubrid-mcp-server show me the schema for the orders table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
cubrid-mcp-server
A Model Context Protocol server for CUBRID, enabling LLMs to safely inspect schemas and execute read-only queries via pycubrid.
Features
Tool | Description |
| List every user table in the database |
| Substring search over table names |
| Column types, nullability, defaults, and primary key info |
| Full metadata: columns, primary key, and indexes in one call |
| Indexes for a table with key columns and flags |
| Execution plan/trace for a |
|
|
| CUBRID |
| CUBRID |
| Run read-only SQL with automatic output truncation |
| Verify database connectivity on demand |
| Run a single |
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 | Description |
| CUBRID agent guide: dialect, types, performance |
| 4 topic guides: sql-dialect, types, performance, collections |
| Whole-schema index: every user table with its per-table resource URI |
| Per-table metadata (columns, primary key, indexes) — mirrors |
Both return application/json. Table names in {table} are percent-decoded by URI-template matching; an unknown or system table produces a resource-read error, matching the describe_table tool.
Related MCP server: mcp-server-rdbms
Prompts
The server also exposes a small set of MCP Prompt templates — reusable, guided
starting points for common inspection tasks. Prompts are guidance-only: each one
returns text that tells the client which of the existing read-only tools to call and
in what order. They never touch the database, execute SQL, or add any new data-access
surface, and any argument you pass is fenced and treated strictly as untrusted data.
The prompts are advisory templates only — the actual read-only enforcement remains in
the underlying tools (execute_query/explain_query via safety.py).
Prompt | Arguments | Description |
|
| Describe a table, then sample it with a bounded read-only query |
|
| Obtain and interpret a |
| (none) | Build a high-level overview of the whole schema from the read-only tools |
|
| Review a table's index coverage for potential review areas |
Quick Start
Configure
Set the required environment variables:
export CUBRID_HOST=localhost
export CUBRID_PORT=33000 # optional, default: 33000
export CUBRID_USER=readonly_user # a CUBRID user with SELECT-only grants (see Security)
export CUBRID_PASSWORD=secret
export CUBRID_DATABASE=mydbOptional settings:
Variable | Default | Description |
|
| Enforce read-only SQL whitelist |
|
| Max characters in query output |
|
| Max rows returned by |
|
| Max length (characters) of a submitted SQL statement |
|
| Per-statement socket read timeout in seconds. If the server sends no data within this window the query is aborted and the connection is reset. This is a socket read timeout, not a true server-side statement timeout. |
|
| Opt-in audit logging. When enabled, emits one redaction-safe JSON record per executed statement ( |
|
| Opt-in write mode. When enabled ( |
Multiple connections
By default the bare CUBRID_* variables define a single connection named default.
You can serve additional CUBRID databases from the same process by listing extra
connection names in CUBRID_CONNECTIONS (comma-separated) and providing
CUBRID_<NAME>_* variables for each. Every tool accepts an optional connection
argument selecting which connection to target; omitting it (or passing default)
uses the bare-variable connection, so existing single-database setups are unchanged.
# Default connection (unchanged)
export CUBRID_HOST=localhost
export CUBRID_USER=readonly_user
export CUBRID_PASSWORD=secret
export CUBRID_DATABASE=mydb
# Additional named connections
export CUBRID_CONNECTIONS=reporting,analytics
export CUBRID_REPORTING_HOST=reporting-db
export CUBRID_REPORTING_USER=readonly_user
export CUBRID_REPORTING_PASSWORD=secret
export CUBRID_REPORTING_DATABASE=reports
export CUBRID_REPORTING_MCP_MAX_ROWS=500 # optional per-connection tuning
export CUBRID_ANALYTICS_HOST=analytics-db
export CUBRID_ANALYTICS_USER=readonly_user
export CUBRID_ANALYTICS_PASSWORD=secret
export CUBRID_ANALYTICS_DATABASE=analyticsNotes:
Connection names must match
[A-Za-z0-9_]+and are matched case-insensitively.defaultis reserved (it always comes from the bareCUBRID_*variables) and cannot appear inCUBRID_CONNECTIONS.For a named connection
<NAME>, connection fields live atCUBRID_<NAME>_HOSTetc. and the optional MCP tuning knobs atCUBRID_<NAME>_MCP_*(same suffixes as the global ones). Named connections do not inherit values from the bare vars.Selecting an unknown connection returns a clear error listing the available names.
Each connection has its own read-only enforcement, so a named connection can set
CUBRID_<NAME>_MCP_READONLYindependently of the default.
Run
Run from PyPI
Use uvx to run directly from PyPI:
uvx cubrid-mcp-serverOr with pipx:
pipx run cubrid-mcp-serverRun from source
git clone https://github.com/cubrid-lab/cubrid-mcp-server.git
cd cubrid-mcp-server
python -m venv .venv && source .venv/bin/activate
pip install -e .
cubrid-mcp-serverMCP Client Integration
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"cubrid": {
"command": "uvx",
"args": ["cubrid-mcp-server"],
"env": {
"CUBRID_HOST": "localhost",
"CUBRID_USER": "readonly_user",
"CUBRID_PASSWORD": "secret",
"CUBRID_DATABASE": "mydb"
}
}
}
}Claude Code
Add to .mcp.json in your project root:
{
"mcpServers": {
"cubrid": {
"command": "uvx",
"args": ["cubrid-mcp-server"],
"env": {
"CUBRID_HOST": "localhost",
"CUBRID_USER": "readonly_user",
"CUBRID_PASSWORD": "secret",
"CUBRID_DATABASE": "mydb"
}
}
}
}Cursor
Add to .cursor/mcp.json:
{
"mcpServers": {
"cubrid": {
"command": "uvx",
"args": ["cubrid-mcp-server"],
"env": {
"CUBRID_HOST": "localhost",
"CUBRID_USER": "readonly_user",
"CUBRID_PASSWORD": "secret",
"CUBRID_DATABASE": "mydb"
}
}
}
}Security
The server is read-only by default. A code-level SQL whitelist allows only SELECT, SHOW, DESC, DESCRIBE, EXPLAIN, and WITH statements. Multi-statement queries are rejected.
The SQL whitelist is defense-in-depth, not a security boundary. It is a non-validating parser-based guardrail against obvious mistakes. The real enforcement layer is the database itself: always run the server as a CUBRID user that has only
SELECTgrants on the tables the model may read. SeeSECURITY.md.
For production use, also configure a read-only database user. See SECURITY.md for the recommended setup.
Write mode (opt-in)
Write access is disabled by default. Setting CUBRID_MCP_WRITE=1 registers an additional execute_write tool that accepts a single INSERT, UPDATE, or DELETE statement and runs it in an explicit transaction (commit on success, rollback on any error). When write mode is off the tool is not registered at all, so no write path is exposed in MCP capability discovery. With multiple connections configured, the tool is registered when any connection enables writes (via CUBRID_MCP_WRITE or CUBRID_<NAME>_MCP_WRITE).
Constraints and rationale:
Single-statement DML only. Standalone reads, DDL (
CREATE/ALTER/DROP/TRUNCATE), transaction-control, and multi-statement input are rejected. (A single DML statement may still legally contain subqueries, e.g.INSERT ... SELECT.)DDL is intentionally unsupported. CUBRID auto-commits DDL, which defeats the rollback guarantee, so it is excluded from write mode.
Write mode is per-connection.
execute_writeaccepts the same optionalconnectionargument as the read tools and runs against that connection; a connection whoseCUBRID_<NAME>_MCP_WRITEis off refuses the write even when another connection enables it.execute_queryremains read-only regardless of the write-mode flag.Enforcement is defense-in-depth; still run the server as a CUBRID user granted only the privileges it needs. See
SECURITY.md.
Logging
The server speaks the MCP stdio transport, where stdout carries the JSON-RPC protocol stream. Anything written to stdout by the server or its dependencies will corrupt that stream and break the client connection. For this reason all logging is routed to stderr, and you should keep it that way: when adding custom logging or diagnostics, never print() to stdout — use the standard logging module (which is configured to emit on stderr) or write to stderr explicitly. The log level defaults to INFO.
Errors surfaced back to the LLM client are sanitized: only the exception category (e.g. query failed: OperationalError) is returned, while the full exception detail is logged to stderr for operators. This keeps schema details, hostnames, SQL fragments, and configuration values out of client-visible messages.
Audit logging (opt-in)
Set CUBRID_MCP_AUDIT_LOG=1 to record every executed statement (execute_query, explain_query, and execute_write) as a single structured JSON line on stderr. It is off by default and honoured per connection — a named connection sets CUBRID_<NAME>_MCP_AUDIT_LOG independently of the default. Each record is redaction-safe and contains only:
Field | Description |
| The MCP tool that ran the statement ( |
|
|
| The leading SQL keyword only (e.g. |
| Table names extracted after |
| Length of the submitted SQL, in characters. |
| Result size and whether output was truncated (success only). |
| Wall-clock duration of the call, in integer milliseconds. |
| On failure, the exception class name only (via the same sanitization as client-facing errors). |
The raw SQL text, bound parameters, and literal values are never logged, so secrets embedded in a query (e.g. WHERE token = '...') do not reach the audit stream. Records go to stderr only and never to stdout.
Development
git clone https://github.com/cubrid-lab/cubrid-mcp-server.git
cd cubrid-mcp-server
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
# Lint & type check
ruff check .
mypy cubrid_mcp_server
# Unit tests
pytest -m "not integration"
# Integration tests (requires running CUBRID)
export CUBRID_HOST=localhost CUBRID_USER=dba CUBRID_PASSWORD="" CUBRID_DATABASE=demodb
pytest -m integrationRelated Projects
pycubrid — Pure-Python DB-API 2.0 driver this server is built on
sqlalchemy-cubrid — SQLAlchemy 2.0–2.2 dialect for CUBRID
cubrid-cookbook-python — 68 runnable examples incl. one-command app templates that use this stack
Disclaimer
This project is part of CUBRID Lab, an independent open-source initiative for CUBRID developer tooling, and is not affiliated with, sponsored by, or endorsed by CUBRID Corporation or the official CUBRID project.
License
MIT (see LICENSE).
Available Tools
11 toolsall_table_namesAll Table NamesB
Return every user table in the connected CUBRID database.
Inputs: connection. Returns: result
describe_tableDescribe TableA
Return full metadata for table_name: columns, primary key, and indexes.
Inputs: table_name (required), connection. Returns: object
execute_queryExecute QueryA
Execute a read-only SQL statement and return rows, truncated if large.
CUBRID SQL notes: prefer LIMIT n OFFSET m (comma form also works); no RETURNING clause; collection types (SET, MULTISET, SEQUENCE) may appear in results — see cubrid://guide/types for interpretation.
Inputs: sql (required), connection. Returns: object
explain_queryExplain QueryA
Return CUBRID's execution plan/trace for a SELECT or WITH statement.
CUBRID uses SHOW TRACE (not standard EXPLAIN). Look for SEQ SCAN in the output — it indicates a full table scan that may benefit from an index. See cubrid://guide/performance for interpretation tips.
Inputs: sql (required), connection. Returns: object
filter_table_namesFilter Table NamesA
Return user tables whose name contains substring (case-insensitive).
Inputs: substring (required), connection. Returns: result
health_checkHealth CheckB
Check database connectivity on demand and report server status.
Inputs: connection. Returns: object
list_class_hierarchyList Class HierarchyC
Return CUBRID CLASS inheritance relationships (all classes or one class).
Inputs: connection, table_name. Returns: result
list_indexesList IndexesC
Return indexes for table_name with their key columns and flags.
CUBRID supports index hints: USE INDEX (idx_name), FORCE INDEX, USING INDEX. See cubrid://guide/performance for hint usage.
Inputs: table_name (required), connection. Returns: result
list_serialsList SerialsC
Return CUBRID SERIAL sequences with current value, increment, and bounds.
Inputs: connection. Returns: result
schema_definitionsSchema DefinitionsB
Return column metadata for table_name: name, type, nullability, default, PK flag.
Inputs: table_name (required), connection. Returns: result
table_row_countsTable Row CountsA
Return COUNT(*) for each table (all user tables by default, capped).
Inputs: connection, table_names. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Each tool has a distinct primary purpose, but schema_definitions and describe_table overlap on column metadata, and describe_table also overlaps with list_indexes on index information. Agents could initially confuse schema_definitions with describe_table, though the descriptions clarify the difference.
Names are readable and mostly snake_case, but conventions are mixed: verb-led names (filter_table_names, describe_table, list_indexes, execute_query) coexist with noun-led names (all_table_names, schema_definitions, table_row_counts, health_check). A uniform verb_noun pattern would improve predictability.
Eleven tools is well within the ideal range for a database introspection server. Each tool addresses a distinct need—discovery, schema, indexes, query planning, execution, and health—without feeling bloated or sparse.
The surface covers table discovery, schema/index metadata, row counts, serials, class hierarchy, query execution, and plan tracing—strong coverage for read-only CUBRID introspection. Minor gaps like foreign-key metadata or object-level DDL are absent but can be worked around via execute_query.
Related MCP Connectors
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Query Postgres, MySQL, SQL Server, Oracle, BigQuery, ClickHouse and Redshift from your AI client.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables LLMs to interact with MySQL databases by inspecting schemas and executing safe, read-only queries within transactions.10MIT
- AlicenseAqualityBmaintenanceEnables LLMs to safely explore, query, diagnose, and modify relational databases through a unified set of schema introspection, SQL execution, and administration tools. Supports multiple database backends with AST-level read-only guards, automatic LIMIT injection, and explicit opt-in write permissions for DML and DDL.651 PyPI1Apache 2.0
- FlicenseNot gradedqualityAmaintenanceEnables LLMs to inspect database schemas and execute SQL queries, including listing tables and describing table schemas.-
- AlicenseAqualityBmaintenanceEnables AI agents to inspect database schemas and run strictly read-only SQL queries with guardrails against destructive statements, multi-statement chaining, and unbounded scans. Supports SQLite natively and PostgreSQL optionally.430 PyPIMIT