gp-mcp-server

dbbaskette/gp-mcp-server

3.3

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).

Tools
5
Resources
0
Prompts
0

๐Ÿ›ก๏ธ Greenplum MCP Server

Spring Boot ยท Spring AI MCP ยท Greenplum/Postgres ยท Encrypted API key vault ยท Streamable HTTP tools


๐Ÿงญ Table of Contents

  1. Why Teams Use It
  2. Feature Spotlight
  3. Front-End Control Center
  4. Architecture Map
  5. MCP Tools & APIs
  6. Run It Now
  7. Configuration Vault
  8. Observability Radar
  9. Security Stance
  10. Development Flow
  11. Further Reading
  12. 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

ToolWhat You GetNotes
gp.listSchemasExplore schemas, tables, and columnsJSON table output with pagination hints
gp.previewQueryValidate SQL without running itUses JSQLParser + policy engine
gp.runQueryExecute parameterized SELECTStreams via JSON Table format
gp.explainProduce verbose query plansSupports ANALYZE toggle
gp.openCursor / gp.fetchCursor / gp.closeCursorServer-side cursor lifecycleHandles large result sets safely
gp.cancelCancel in-flight operationsRoutes 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

LayerSignificant Libraries / APIsWhy It Matters
Template DeliverySpring Boot MVC + ThymeleafServes the HTML shell with zero JavaScript bundling complexity.
StylingModern CSS (flex/grid, system font stack, backdrop-filter, keyframe animations)Produces the glass-card aesthetic, responsive two-column form layout, and animated spinners.
InteractivityVanilla JS, fetch, async/await, FormData helpersPowers connection testing, API key generation, optimistic status toasts, and dynamic field validation with no dependency weight.
UX FlourishesEmoji iconography, alert color palette, inline copy-safe key revealGuides 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 via application.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

CategoryKeyDefaultDescription
DatabaseDB_URLjdbc:postgresql://localhost:15432/postgresTarget Greenplum/Postgres cluster.
DB_USER / DB_PASSWORDgpadmin / secretBootstrap credentials; override in production.
SecurityGP_MCP_ENCRYPTION_KEY(required)Base64-encoded 32-byte key protecting stored credentials.
API_KEY_ENABLEDtrueToggle API key enforcement for local experiments.
PolicyPOLICY_PATHclasspath:policy.ymlMaster policy file for schema/table limits.
DB_SEARCH_PATHpublicDefault search path applied per session.
DB_STATEMENT_TIMEOUT_MS5000Query timeout guardrail (ms).
MCPSERVER_PORT8082HTTP port for the service.
ENVIRONMENTdevelopmentInjected into metrics tags.
TelemetryOTEL_EXPORTER_OTLP_ENDPOINThttp://localhost:4317OpenTelemetry collector endpoint.

Full matrix lives in src/main/resources/application.yml.


๐Ÿ“ก Observability Radar

  • Metrics: Scrape /actuator/prometheus for gp_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

  1. API Key Auth โ€” Spring Security filter verifies every call, binding requests to encrypted credential bundles.
  2. Credential Vault โ€” AES-256-GCM via EncryptionService stores usernames/passwords; keys never rest in plaintext.
  3. Greenplum RBAC โ€” Authorization delegated to database roles; application-level allow lists remain optional.
  4. SQL Guardrails โ€” JSQLParser validation, parameter binding, read-only enforcement, redaction rules, and cancellation hooks.
  5. Operational Hygiene โ€” .env git-ignored, secrets templated in documentation, and SECURITY_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


๐Ÿชช License & Credits

Licensed under the .

Huge thanks to:

Crafted with ๐Ÿ’™ to give every LLM a safe window into Greenplum.