Purpose
gaussdb-ro-mcp is a read-only MCP server for Coding Agents (Claude Code, OpenCode, etc.), used to let agents safely explore Huawei GaussDB (centralized and distributed) databases. The project's positioning emphasizes: if full read-write and operations capabilities are needed, a full-featured server should be chosen; if the goal is to let a Coding Agent safely explore data (especially on production databases), the read-only constraints and defense in depth are the value of this project.
Main capabilities
- Provides database read-only exploration tools via stdio transport, 5 tools in total (integration tests cover their end-to-end behavior).
- Three-layer read-only enforcement: static SQL validation, server-side READ ONLY transactions, least-privilege account guidance.
- Even if the database account is restricted to read-only, SQL validation and session enforcement still block row locking (FOR UPDATE), SELECT INTO, dangerous function calls, long queries, and other behaviors.
- Multi-instance management: the configuration file supports managing multiple GaussDB instances simultaneously; all tools accept an optional instance parameter, defaulting to default_instance; all instance names (including the default annotation) are written into that parameter's schema description, so the agent can discover available instances at the tool-list retrieval stage without trial and error.
- Designed specifically for intranet non-SSL environments, with sslmode=disable by default.
- Distributed as a single static binary, supporting offline builds (the driver source is built into third_party/gaussdb-go and referenced via a replace directive).
- All runtime logs are output to stderr (stdout is the MCP protocol channel), including configuration loading, data source readiness, session read-only validation results, etc., for troubleshooting in the proxy client's MCP logs.
Usage
Installation: platform binaries (linux-amd64 / linux-arm64 / darwin-arm64 / windows-amd64.exe) can be downloaded from Releases; for other platforms or intranet environments, you can build it yourself; checksums for each artifact are in SHA256SUMS.txt on the Release page.
Build: requires Go 1.26.10+ (consistent with go.mod). In a normal networked environment, go build will automatically resolve the remaining dependencies;For a pure intranet environment, first run go mod vendor in a networked environment, then carry the vendor/ directory and build with go build -mod=vendor. Cross-compiling for other platforms (pure Go, CGO_ENABLED=0 is sufficient): CGO_ENABLED=0 GOOS=<os> GOARCH=<arch> go build -o ... ./cmd/gaussdb-ro-mcp.
Configuration: copy gaussdb-ro-mcp.example.yaml to gaussdb-ro-mcp.yaml and modify it. Configuration file lookup order: -config parameter > environment variable GAUSSDB_RO_MCP_CONFIG > ./gaussdb-ro-mcp.yaml.
Integrating with a Coding Agent: method one is the .mcp.json in the project root directory (or the claude mcp add command); OpenCode uses opencode.json configuration.
Testing: you can use Docker to quickly start an openGauss test instance and load test data. Integration tests cover read-only session enforcement (the server rejects writes), end-to-end behavior of the 5 tools, and a smoke test of the real binary as a stdio subprocess. Note: this driver uses the GaussDB extended protocol (3.51) and cannot connect to native PostgreSQL; integration tests require a real GaussDB / openGauss instance.
Applicable Scenarios
- Let a Coding Agent safely explore data structures and data on development or production GaussDB databases.
- Read-only database access in intranet non-SSL environments.
- Agent workflows that need to manage multiple GaussDB instances simultaneously.
Limitations
- Only read-only capabilities are provided; full read-write and operations capabilities are not provided.
- The driver uses the GaussDB extended protocol (3.51) and cannot connect to native PostgreSQL.
- Integration tests require a real GaussDB / openGauss instance.
- Building requires Go 1.26.10+; pure intranet builds require dependencies to be vendored in advance.
- For the specific tool list, configuration field details, and integration example code, please refer to the repository README and README_en.md.