dbbaskette/gp-mcp-server
If you are the rightful owner of gp-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Greenplum MCP Server is a Spring Boot application designed to provide secure and efficient query tools for Greenplum and PostgreSQL databases using the Model Context Protocol (MCP).
๐ก๏ธ Greenplum MCP Server
Spring Boot ยท Spring AI MCP ยท Greenplum/Postgres ยท Encrypted API key vault ยท Streamable HTTP tools
๐งญ Table of Contents
- Why Teams Use It
- Feature Spotlight
- Front-End Control Center
- Architecture Map
- MCP Tools & APIs
- Run It Now
- Configuration Vault
- Observability Radar
- Security Stance
- Development Flow
- Further Reading
- License & Credits
โจ Why Teams Use It
- ๐ Multi-tenant guardrails โ Every API key maps to a distinct Greenplum role with credentials encrypted via AES-256-GCM.
- ๐ง Smart SQL tooling โ Policy-aware query execution, EXPLAIN plans, schema exploration, and cursor streaming through Spring AI MCP.
- โก Ops friendly โ HikariCP per-tenant pools, Prometheus and OpenTelemetry hooks, health endpoints, and structured audit logs out of the box.
- ๐งฑ Production ready โ Built on Spring Boot 3.5, tested against Greenplum/Postgres targets, and configurable entirely via environment variables.
- ๐๏ธ Zero-leak posture โ Secrets live in
.env
, the repo ships with templates only, and client guides reference placeholders instead of live values.
๐ Feature Spotlight
๐งฐ MCP Toolbelt
Tool | What You Get | Notes |
---|---|---|
gp.listSchemas | Explore schemas, tables, and columns | JSON table output with pagination hints |
gp.previewQuery | Validate SQL without running it | Uses JSQLParser + policy engine |
gp.runQuery | Execute parameterized SELECT | Streams via JSON Table format |
gp.explain | Produce verbose query plans | Supports ANALYZE toggle |
gp.openCursor / gp.fetchCursor / gp.closeCursor | Server-side cursor lifecycle | Handles large result sets safely |
gp.cancel | Cancel in-flight operations | Routes through connection manager |
๐งฎ Platform Superpowers
- Per-key pools โ
DatabaseConnectionManager
spins up isolated HikariCP pools so noisy neighbors stay contained. - Policy enforcement โ
policy.yml
governs max rows, byte budgets, schema/table allow lists, and redaction rules. - SQL inspection โ
SchemaTools
+JSQLParser
prevent mutations, multi-statements, and disallowed functions. - Streaming transport โ Implements the MCP Streamable HTTP spec for responsive LLM tool usage.
๐จ Front-End Control Center
The admin console at /admin/api-keys
ships as a polished single-file experience (src/main/resources/templates/api-keys.html
). It is intentionally framework-light but far from plain.
UI Stack at a Glance
Layer | Significant Libraries / APIs | Why It Matters |
---|---|---|
Template Delivery | Spring Boot MVC + Thymeleaf | Serves the HTML shell with zero JavaScript bundling complexity. |
Styling | Modern CSS (flex/grid, system font stack, backdrop-filter , keyframe animations) | Produces the glass-card aesthetic, responsive two-column form layout, and animated spinners. |
Interactivity | Vanilla JS, fetch , async/await, FormData helpers | Powers connection testing, API key generation, optimistic status toasts, and dynamic field validation with no dependency weight. |
UX Flourishes | Emoji iconography, alert color palette, inline copy-safe key reveal | Guides operators to save secrets, highlights failure modes, and keeps the experience friendly. |
Experience Touches
- Connection dry-runs โ The "Test Connection" button posts to
/admin/api-keys/test-connection
before any credential is minted. - Guarded secrets โ Inline banners warn that generated keys display once; the layout encourages instant copy & storage.
- Responsive grid โ CSS grid collapses to a single column below 600px for tablet administration on the go.
- Zero build step โ Everything lives in one HTML file; changes deploy with your next Spring Boot restart.
๐๏ธ Architecture Map
flowchart LR
subgraph Client["๐งโ๐ป MCP Clients" ]
Tooling1[API Key 1]
Tooling2[API Key 2]
end
subgraph Gateway["โ Spring Boot 3.5"]
Security[Spring Security<br/>API Key Filter]
MCPServer[MCP Tool Controller]
PolicySvc[Policy Service]
SQLGuard[SQL Validator]
QueryOps[Query Tools]
KeyVault[Credential Vault]
end
subgraph Data["๐๏ธ Greenplum / Postgres"]
Pool1[HikariCP Pool โ User A]
Pool2[HikariCP Pool โ User B]
end
subgraph Telemetry["๐ก Observability"]
OTEL[OpenTelemetry]
Metrics[Prometheus Metrics]
Logs[Structured Logging]
end
Client -->|Bearer Key| Security
Security --> MCPServer
MCPServer --> PolicySvc
MCPServer --> SQLGuard
MCPServer --> QueryOps
QueryOps --> Pool1
QueryOps --> Pool2
Pool1 --> Data
Pool2 --> Data
KeyVault --> Security
QueryOps --> Telemetry
PolicySvc --> Telemetry
๐ MCP Tools & APIs
- Streamable HTTP Endpoint:
POST /mcp
(configurable viaapplication.yml
). - Admin Console Endpoints:
POST /admin/api-keys/generate
POST /admin/api-keys/test-connection
GET /admin/api-keys
(serves the console)
- Actuator Surface:
/actuator/health
,/actuator/prometheus
,/actuator/info
for ops integrations.
Pair this server with any MCP-aware client (e.g., LaunchDarkly MCP Inspector, OpenAI assistants, or the sibling ).
โ๏ธ Run It Now
# 1) Clone
git clone https://github.com/dbbaskette/gp-mcp-server.git
cd gp-mcp-server
# 2) Generate an encryption key for API credential storage
openssl rand -base64 32
# 3) Create your .env (never commit this file)
cat > .env <<'ENV'
export DB_URL=jdbc:postgresql://localhost:15432/postgres
export DB_USER=gpadmin
export DB_PASSWORD=your_admin_password
export GP_MCP_ENCRYPTION_KEY=your_generated_encryption_key
export SERVER_PORT=8082
ENV
# 4) Launch
./run.sh # loads .env, builds if needed, starts Spring Boot
# or
./mvnw clean spring-boot:run
Visit http://localhost:8082/admin/api-keys
to mint keys and http://localhost:8082/mcp
for MCP traffic.
๐ง Configuration Vault
Category | Key | Default | Description |
---|---|---|---|
Database | DB_URL | jdbc:postgresql://localhost:15432/postgres | Target Greenplum/Postgres cluster. |
DB_USER / DB_PASSWORD | gpadmin / secret | Bootstrap credentials; override in production. | |
Security | GP_MCP_ENCRYPTION_KEY | (required) | Base64-encoded 32-byte key protecting stored credentials. |
API_KEY_ENABLED | true | Toggle API key enforcement for local experiments. | |
Policy | POLICY_PATH | classpath:policy.yml | Master policy file for schema/table limits. |
DB_SEARCH_PATH | public | Default search path applied per session. | |
DB_STATEMENT_TIMEOUT_MS | 5000 | Query timeout guardrail (ms). | |
MCP | SERVER_PORT | 8082 | HTTP port for the service. |
ENVIRONMENT | development | Injected into metrics tags. | |
Telemetry | OTEL_EXPORTER_OTLP_ENDPOINT | http://localhost:4317 | OpenTelemetry collector endpoint. |
Full matrix lives in src/main/resources/application.yml
.
๐ก Observability Radar
- Metrics: Scrape
/actuator/prometheus
forgp_mcp_query_executions_total
,gp_mcp_query_duration_seconds
, and per-pool Hikari stats (hikaricp_connections_active
). - Tracing: OpenTelemetry spans track authentication, policy evaluation, SQL execution, and cursor lifecycle events.
- Logging: Structured patterns emitted to console and
logs/gp-mcp-server.log
; include trace/span IDs when tracing is enabled. - Health:
/actuator/health
(overall) and/actuator/health/db
(database connectivity) integrate cleanly with uptime checks.
๐ Security Stance
- API Key Auth โ Spring Security filter verifies every call, binding requests to encrypted credential bundles.
- Credential Vault โ AES-256-GCM via
EncryptionService
stores usernames/passwords; keys never rest in plaintext. - Greenplum RBAC โ Authorization delegated to database roles; application-level allow lists remain optional.
- SQL Guardrails โ JSQLParser validation, parameter binding, read-only enforcement, redaction rules, and cancellation hooks.
- Operational Hygiene โ
.env
git-ignored, secrets templated in documentation, andSECURITY_COMPLIANCE_REPORT.md
captures review evidence.
Rotate any placeholder secrets you copied from older docs; historic values should be considered compromised.
๐งฐ Development Flow
# Install dependencies & build
./mvnw clean compile
# Run unit tests
./mvnw test
# Launch with live reload (DevTools)
./mvnw spring-boot:run
# Format / lint hooks (if configured later)
./mvnw spotless:apply
Recommended next steps:
- Add a GitHub Actions workflow running the build + tests on pull requests.
- Wire the MCP endpoint into
gp-assistant
or another client for end-to-end smoke tests. - Extend the admin console with audit history for key issuance.
๐ Further Reading
- โ Client configuration patterns and inspector examples.
- โ Credential rotation, expiry, and policy guardrails.
- โ Current security posture snapshot.
- Spring AI MCP Overview
- Greenplum Documentation
๐ชช License & Credits
Licensed under the .
Huge thanks to:
- Spring Boot & Spring AI for the MCP server foundation.
- Greenplum Database for the massively parallel SQL core.
- OpenTelemetry and Micrometer for observability tooling.
Crafted with ๐ to give every LLM a safe window into Greenplum.