MCP Hub
Back to servers

Couchbase-Analytics-MCP

A production-grade MCP server for Couchbase Enterprise Analytics, exposing 25 tools to execute SQL++ queries, manage schema and indexes, configure links, and monitor cluster health.

glama
Updated
Apr 24, 2026

Couchbase-Analytics-MCP

A production-grade Model Context Protocol (MCP) server for the Couchbase Enterprise Analytics service. Exposes the full Analytics API surface as 25 strongly-typed MCP tools, with a built-in GUI console, structured logging, Prometheus metrics, OpenTelemetry tracing, and comprehensive test coverage.

Important: This server targets the Analytics service (Apache AsterixDB engine, SQL++, port 8095) — not the Couchbase Query (N1QL) service. All tools call cluster.analyticsQuery() and /analytics/* REST endpoints exclusively.


Feature matrix

FeatureStatus
25 MCP tools covering full Analytics API
stdio transport (Claude Desktop)
SSE/HTTP transport (remote agents)
Connection pool (min/max/idle reaper)
JWT + API key auth on SSE endpoint
Structured JSON logging (Pino)
Daily log rotation (pino-roll)
Optional Loki push transport
Prometheus /metrics endpoint
OpenTelemetry traces → Jaeger
/health/live + /health/ready probes
React GUI console at /console
Monaco SQL++ editor
Schema browser (dataverse → dataset tree)
Live tool call inspector
Unit tests (≥90% coverage)
Integration tests (real Couchbase)
E2E tests (Supertest SSE transport)
Docker multi-stage image
Docker Compose (CB + Prometheus + Grafana + Jaeger)
Helm chart
GitHub Actions CI/CD
Architecture docs + ADRs
Operational runbooks

Quick start

Prerequisites

  • Node.js ≥ 20
  • Docker + Docker Compose
  • Couchbase Server Enterprise ≥ 7.2 with Analytics service enabled

Local development (Docker Compose)

git clone https://github.com/your-org/couchbase-analytics-mcp
cd couchbase-analytics-mcp

# Copy and edit environment
cp .env.example .env

# Start Couchbase + MCP server + Prometheus + Grafana + Jaeger
docker-compose up -d

# GUI console: http://localhost:3000/console
# Prometheus:  http://localhost:9091
# Grafana:     http://localhost:3001  (admin/admin)
# Jaeger:      http://localhost:16686

Run against an existing Couchbase cluster

npm install

CB_CONNECTION_STRING=couchbase://my-cluster \
CB_USERNAME=Administrator \
CB_PASSWORD=password \
TRANSPORT=stdio \
node packages/mcp-server/dist/index.js

Claude Desktop integration

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "couchbase-analytics": {
      "command": "node",
      "args": ["/path/to/couchbase-analytics-mcp/packages/mcp-server/dist/index.js"],
      "env": {
        "CB_CONNECTION_STRING": "couchbase://your-cluster",
        "CB_USERNAME": "Administrator",
        "CB_PASSWORD": "your-password",
        "TRANSPORT": "stdio"
      }
    }
  }
}

Environment variables

VariableDefaultDescription
CB_CONNECTION_STRING(required)couchbase://host or couchbases://host for TLS
CB_USERNAME(required)Couchbase RBAC username
CB_PASSWORD(required)Couchbase RBAC password
CB_ANALYTICS_PORT8095Analytics REST port (18095 for TLS)
CB_ANALYTICS_TLSfalseEnable TLS for REST calls
TRANSPORTstdiostdio or sse
PORT3000HTTP server port (SSE + health + GUI)
POOL_MIN2Minimum pool connections
POOL_MAX10Maximum pool connections
POOL_IDLE_TIMEOUT_MS30000Idle connection reap threshold
QUERY_DEFAULT_TIMEOUT_MS60000Default query timeout
LOG_LEVELinfotrace|debug|info|warn|error|fatal
LOG_FORMATjsonjson|pretty
LOG_FILE_ENABLEDfalseEnable file transport
LOG_FILE_PATH/var/log/cba-mcp/server.logLog file path
LOKI_HOST(optional)Loki push endpoint
METRICS_ENABLEDtrueExpose /metrics
OTEL_ENABLEDfalseEnable OpenTelemetry tracing
JAEGER_ENDPOINThttp://localhost:14268/api/tracesJaeger HTTP collector
JWT_SECRET(optional)JWT signing secret for SSE auth
API_KEY(optional)Static API key for SSE auth
GUI_ENABLEDtrueServe GUI at /console

Tool reference

See docs/api/TOOLS.md for full input/output schemas.

ToolGroupDescription
analytics_executeQueryExecute SQL++ statement
analytics_explainQueryReturn query execution plan
analytics_cancelQueryCancel running query
analytics_query_statusQueryCheck async query status
analytics_pending_mutationsQueryKV→Analytics replication lag
analytics_list_dataversesSchemaList all dataverses
analytics_list_datasetsSchemaList datasets
analytics_describe_datasetSchemaField-level dataset description
analytics_infer_schemaSchemaINFER DATASET → JSON Schema
analytics_list_indexesSchemaList Analytics secondary indexes
analytics_create_dataverseDataverseCREATE DATAVERSE
analytics_drop_dataverseDataverseDROP DATAVERSE
analytics_create_datasetDataverseCREATE DATASET (shadow collection)
analytics_drop_datasetDataverseDROP DATASET
analytics_alter_datasetDataverseModify dataset WHERE predicate
analytics_list_linksLinksList data source links
analytics_create_linkLinksCreate CB/S3/Azure/GCS link
analytics_alter_linkLinksUpdate link configuration
analytics_drop_linkLinksDelete a link
analytics_connect_linkLinksStart ingestion (CONNECT LINK)
analytics_disconnect_linkLinksPause ingestion (DISCONNECT LINK)
analytics_create_indexIndexesCREATE Analytics secondary index
analytics_drop_indexIndexesDROP Analytics secondary index
analytics_analyze_datasetIndexesCollect optimizer statistics
analytics_node_agg_statsClusterPer-node resource stats
analytics_service_healthClusterComposite health summary
analytics_cluster_configClusterAnalytics service configuration
analytics_set_config_paramClusterMutate config param (guarded)
analytics_restart_nodeClusterRestart Analytics node(s) (guarded)

Development

# Install all workspace dependencies
npm install

# Build all packages
npm run build

# Run unit tests with coverage
npm run test:coverage

# Run integration tests (requires Couchbase)
docker-compose up -d couchbase
npm run test:integration -w packages/mcp-server

# Start dev server (hot reload)
npm run dev

# Generate API docs
npm run docs

Support Policy

I truly appreciate your interest in this project! This project is community-maintained. However, I actively monitor and maintain this repo and will try to resolve issues on a best-effort basis.

All inquiries should be through GitHub.

Bug reports: Open a GitHub issue
Feature requests: Open a GitHub issue with the "enhancement" label
Questions: Open a GitHub issue

Your collaboration helps me move forward together - thank you! Pull requests and contributions from the community are welcome and encouraged.


Architecture

See docs/architecture/ARCHITECTURE.md for the full component diagram, data flow description, and design decisions.

Reviews

No reviews yet

Sign in to write a review