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.
README
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
| Feature | Status |
|---|---|
| 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
| Variable | Default | Description |
|---|---|---|
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_PORT |
8095 |
Analytics REST port (18095 for TLS) |
CB_ANALYTICS_TLS |
false |
Enable TLS for REST calls |
TRANSPORT |
stdio |
stdio or sse |
PORT |
3000 |
HTTP server port (SSE + health + GUI) |
POOL_MIN |
2 |
Minimum pool connections |
POOL_MAX |
10 |
Maximum pool connections |
POOL_IDLE_TIMEOUT_MS |
30000 |
Idle connection reap threshold |
QUERY_DEFAULT_TIMEOUT_MS |
60000 |
Default query timeout |
LOG_LEVEL |
info |
trace|debug|info|warn|error|fatal |
LOG_FORMAT |
json |
json|pretty |
LOG_FILE_ENABLED |
false |
Enable file transport |
LOG_FILE_PATH |
/var/log/cba-mcp/server.log |
Log file path |
LOKI_HOST |
(optional) | Loki push endpoint |
METRICS_ENABLED |
true |
Expose /metrics |
OTEL_ENABLED |
false |
Enable OpenTelemetry tracing |
JAEGER_ENDPOINT |
http://localhost:14268/api/traces |
Jaeger HTTP collector |
JWT_SECRET |
(optional) | JWT signing secret for SSE auth |
API_KEY |
(optional) | Static API key for SSE auth |
GUI_ENABLED |
true |
Serve GUI at /console |
Tool reference
See docs/api/TOOLS.md for full input/output schemas.
| Tool | Group | Description |
|---|---|---|
analytics_execute |
Query | Execute SQL++ statement |
analytics_explain |
Query | Return query execution plan |
analytics_cancel |
Query | Cancel running query |
analytics_query_status |
Query | Check async query status |
analytics_pending_mutations |
Query | KV→Analytics replication lag |
analytics_list_dataverses |
Schema | List all dataverses |
analytics_list_datasets |
Schema | List datasets |
analytics_describe_dataset |
Schema | Field-level dataset description |
analytics_infer_schema |
Schema | INFER DATASET → JSON Schema |
analytics_list_indexes |
Schema | List Analytics secondary indexes |
analytics_create_dataverse |
Dataverse | CREATE DATAVERSE |
analytics_drop_dataverse |
Dataverse | DROP DATAVERSE |
analytics_create_dataset |
Dataverse | CREATE DATASET (shadow collection) |
analytics_drop_dataset |
Dataverse | DROP DATASET |
analytics_alter_dataset |
Dataverse | Modify dataset WHERE predicate |
analytics_list_links |
Links | List data source links |
analytics_create_link |
Links | Create CB/S3/Azure/GCS link |
analytics_alter_link |
Links | Update link configuration |
analytics_drop_link |
Links | Delete a link |
analytics_connect_link |
Links | Start ingestion (CONNECT LINK) |
analytics_disconnect_link |
Links | Pause ingestion (DISCONNECT LINK) |
analytics_create_index |
Indexes | CREATE Analytics secondary index |
analytics_drop_index |
Indexes | DROP Analytics secondary index |
analytics_analyze_dataset |
Indexes | Collect optimizer statistics |
analytics_node_agg_stats |
Cluster | Per-node resource stats |
analytics_service_health |
Cluster | Composite health summary |
analytics_cluster_config |
Cluster | Analytics service configuration |
analytics_set_config_param |
Cluster | Mutate config param (guarded) |
analytics_restart_node |
Cluster | Restart 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.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.