GaussDB-MCP
Provides tools for interacting with Huawei GaussDB databases, enabling SQL queries, data manipulation, schema and table management, transaction handling, and metadata retrieval.
Click on "Install 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., "@GaussDB-MCPlist all tables in the public schema"
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.
GaussDB MCP
Huawei Cloud GaussDB cloud database MCP server. Built on Huawei's official GaussDB dedicated Node.js driver gaussdb-node, following the MCP 2026-07-28 specification, providing 24 tools and 1 table structure resource covering connection testing, querying, data writing, transactions, metadata, diagnostics and operations, user permissions, etc.
Quick Start
npm install
cp .env.example .env # Windows: copy .env.example .env 后编辑
# 编辑 .env,填入 GaussDB 实例地址、密码等
npm run build
node build/index.js # 启动(stdio,供 MCP 客户端拉起)Requires Node.js ≥ 20.
Related MCP server: mcp-db-assistant
Connection Configuration
All Environment Variables
Variable | Required | Default | Description |
| Yes | — | GaussDB instance address; for primary/standby multi-node, separate with English commas (e.g. |
| No |
| Database port; Huawei Cloud GaussDB cloud instances default to 8000 |
| No |
| Database name |
| No |
| Login user; default administrator is root |
| Yes | — | Login password |
| No | — | Default schema, corresponding to JDBC's |
| No |
| For primary/standby multi-node, connect only to the primary node (corresponds to JDBC |
| No |
| Set to |
| No | — | CA root certificate path (download |
| No | — | Client certificate path (only needed for mutual authentication) |
| No | — | Client private key path (only needed for mutual authentication) |
| No |
| Whether to verify the server certificate; can be set to |
Intranet Connection Configuration
Used when the application and the GaussDB instance are in the same VPC. SSL is not required (intranet traffic does not leak externally; Huawei Cloud officially defaults to direct intranet connection):
GAUSSDB_HOST=10.0.1.11 # 实例"节点列表"中的内网地址
GAUSSDB_PORT=8000
GAUSSDB_DATABASE=postgres
GAUSSDB_USER=root
GAUSSDB_PASSWORD=你的密码
# 不设置任何 GAUSSDB_SSL_* 变量,保持 GAUSSDB_SSL=0(默认)Public Network Connection Configuration
Used when the application is not in the instance's VPC and accesses it via an elastic public IP. SSL must be enabled and a CA certificate configured (Huawei Cloud official sslmode=verify-ca approach):
GAUSSDB_HOST=114.114.114.114 # 实例绑定的弹性公网 IP
GAUSSDB_PORT=8000
GAUSSDB_DATABASE=postgres
GAUSSDB_USER=root
GAUSSDB_PASSWORD=你的密码
GAUSSDB_SSL=1
GAUSSDB_SSL_CA=C:/path/to/root.crt # 华为云控制台下载的 CA 证书(公网连接必需)
GAUSSDB_SSL_REJECT_UNAUTHORIZED=trueBefore public network connection, you also need to allow the client's egress IP access to port 8000 in the Huawei Cloud console security group.
How to Add Environment Variables
Two methods, choose either one (when both exist, environment variables take precedence over .env):
Project
.envfile (recommended): Copy.env.exampleto.envin the project root directory and fill it in. The.envlocation is anchored to the project root directory, independent of which directory the server is started from — the MCP client can read it when launchingbuild/index.jsfrom any working directory. Write either of the two configurations above directly into.env.MCP client
envfield: Pass environment variables directly in themcpServersconfiguration (see integration examples below), suitable for scenarios where you don't want to put credential files in the project.
For primary/standby deployments, separate multiple node IPs in GAUSSDB_HOST with English commas. The server tries connecting to each in sequence at startup and automatically selects the first available node.
Tool Overview (24 tools)
All tools are annotated with annotations (readOnlyHint/destructiveHint) per the MCP specification, allowing clients to prompt for confirmation on write operations.
Connection and Status
Tool | Description |
| Test connection, returns GaussDB version, current database, current user |
Query and Write
Tool | Description |
| Execute read-only queries (starting with SELECT/WITH/EXPLAIN/SHOW/VALUES, single statement; write statements and multi-statements are rejected), truncated by limit (default 100)/offset, optional |
| Execute arbitrary SQL (DDL/DML), returns affected row count, optional |
| Parameterized batch insert (table name + row array, optional schema) |
| Parameterized update (set + where, where is required to prevent accidental full-table updates, optional schema) |
| Parameterized delete (where is required to prevent accidental full-table deletes, optional schema, destructive annotation) |
Transactions (explicit handle mode)
Tool | Description |
| Begin a transaction, returns |
| Commit the transaction |
| Roll back the transaction |
Usage: transaction_begin → multiple query/execute (passing the same tx_handle) → transaction_commit or transaction_rollback.
Metadata (read-only)
Tool | Description |
| Database / schema / table lists |
| Column definitions: type, length, nullable, default, primary key |
| Index / view / sequence lists |
Diagnostics and Operations (read-only)
Tool | Description |
| Execution plan; with |
| Current active sessions |
| Lock conflicts (blocked party and blocking source) |
| Version, database size, connection count, server address and time |
Users and Permissions
Tool | Description |
| User list (read-only) |
| Create a login-enabled user |
| Grant / revoke (e.g. |
Resources
Resource URI | Description |
| Read table structure as JSON |
MCP Client Integration
After building, register in the client configuration file (using Claude Desktop / Cursor's mcpServers format as an example). Windows uses double backslash paths (E:\\MCP\\GaussDBMCP\\build\\index.js), Linux/macOS uses forward slashes (/home/user/GaussDBMCP/build/index.js).
Intranet Connection Integration
{
"mcpServers": {
"gaussdb": {
"command": "node",
"args": ["E:\\MCP\\GaussDBMCP\\build\\index.js"],
"env": {
"GAUSSDB_HOST": "10.0.1.11",
"GAUSSDB_PORT": "8000",
"GAUSSDB_DATABASE": "postgres",
"GAUSSDB_USER": "root",
"GAUSSDB_PASSWORD": "你的密码"
}
}
}
}Intranet connection does not require SSL; simply do not set any GAUSSDB_SSL_* variables.
Public Network Connection Integration
{
"mcpServers": {
"gaussdb": {
"command": "node",
"args": ["E:\\MCP\\GaussDBMCP\\build\\index.js"],
"env": {
"GAUSSDB_HOST": "114.114.114.114",
"GAUSSDB_PORT": "8000",
"GAUSSDB_DATABASE": "postgres",
"GAUSSDB_USER": "root",
"GAUSSDB_PASSWORD": "你的密码",
"GAUSSDB_SSL": "1",
"GAUSSDB_SSL_CA": "C:\\path\\to\\root.crt",
"GAUSSDB_SSL_REJECT_UNAUTHORIZED": "true"
}
}
}
}Public network connection must enable SSL and configure a CA certificate, and ensure the security group allows the client's egress IP access to port 8000.
You can also omit env and rely on the .env file in the project root directory (automatically read at server startup, anchored to the project root, independent of the startup directory).
Multi-Tenant Isolation (stream = schema)
GAUSSDB_SEARCH_PATH also serves as the MCP-layer schema whitelist: once configured, access is restricted to the corresponding stream's own schema, and tables of other streams cannot be seen.
MCP-layer interception (reliable, based on structural parameters):
list_schemasonly returns schemas in the whitelist, not leaking other schema nameslist_tables/list_indexes/list_views/list_sequencesdefault to pinning to the first whitelisted schema when no schema is passed, no longer returning all database tablesdescribe_table/insert_rows/update_rows/delete_rowswith an explicitschemaparameter will directly error and reject if it is not in the whitelistThe table structure resource
gaussdb://{schema}/{table}/schemais also subject to the whitelist; cross-schema reads are rejected
Database permission-layer fallback (required, cannot be omitted): execute accepts arbitrary SQL, and the MCP layer does not parse SQL (a hand-written parser will always have bypass paths); although query enforces read-only (first-keyword whitelist + write-keyword blacklist + rejection of multi-statements), side-effect functions in SELECT form (such as pg_terminate_backend, setval) cannot be exhaustively intercepted. Cross-schema access and side-effect functions are guaranteed by GaussDB permissions. Each stream uses an independent restricted account, authorized only for its own schema:
-- 以管理员执行:为 stream 建受限账号,只授予自己 schema 的权限
CREATE USER gycwd_app WITH PASSWORD 'xxx' LOGIN;
REVOKE ALL ON DATABASE postgres FROM PUBLIC; -- 收紧库级默认权限
GRANT CONNECT ON DATABASE postgres TO gycwd_app;
GRANT USAGE ON SCHEMA gycwd TO gycwd_app; -- 只给自己的 schema
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA gycwd TO gycwd_app;
-- 该账号未授予其他 schema 的 USAGE,即使手写跨 schema SQL 也会被数据库拒绝Then in .env set GAUSSDB_USER=gycwd_app, GAUSSDB_SEARCH_PATH=gycwd, with two layers combined: structural entry points intercepted by MCP, arbitrary SQL intercepted by the database.
Security Notes
stdio server logs are all written to stderr; stdout only carries MCP messages
Identifiers such as table names/column names/user names in structured tools (insert_rows/update_rows/delete_rows, etc.) are all character-validated, and values always use parameterized placeholders to prevent SQL injection;
query/explain_queryare free-form SQL entry points, narrowed down by read-only validation and single-statement restrictions (see above)delete_rows/update_rowsenforce a where conditionexplain_querywith analyze=true actually executes the statement, only allowing statements starting with SELECT/WITH and automatically wrapping in a transaction rollback (sequence advancement and function side effects are not rollback-able)Statements such as
DROP/TRUNCATEcan be executed viaexecute; clients should rely on the destructiveHint annotation for confirmationDo not commit
.envto version control
Development and Build
npm run build # tsc 编译到 build/Source structure: src/config.ts (configuration), src/db.ts (connection pool and transaction handles), src/sql.ts (SQL construction and read-only validation), src/format.ts (result formatting), src/index.ts (MCP server and tool registration).
Once you have a real GaussDB instance: fill in .env → npm run build → node build/index.js and test with any MCP client; or first verify the connection separately: configure env and run the test_connection tool.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server for connecting to databases (PostgreSQL, MySQL, SQL Server, Redis) enabling SQL queries, table exploration, and Redis key-value operations.1MIT
- AlicenseNot gradedqualityBmaintenanceA database operation server based on the MCP protocol, providing database connection, querying, schema exploration, data analysis, and SQL generation tools.MIT
- AlicenseNot gradedqualityBmaintenanceMCP server for multiple databases (PostgreSQL, MySQL, MariaDB, SQLite, MongoDB, Redis) with tools for schema inspection, querying, performance diagnostics, and safe write operations, featuring access modes, PII masking, and audit logging.Apache 2.0
- AlicenseAqualityCmaintenanceA comprehensive PostgreSQL MCP server providing 27 tools for database management and administration, including connection management, query execution, schema introspection, CRUD operations, and server monitoring.2738AGPL 3.0
Related MCP Connectors
MCP server for managing Prisma Postgres.
GibsonAI MCP server: manage your databases with natural language
MCP server for interacting with the Supabase platform
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mengqi1436/GaussDB-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server