cb-analytics-mcp
Provides tools for querying, schema introspection, ingestion control, link management, UDF libraries, RBAC, cluster admin, and Capella cloud management for Couchbase Analytics (Enterprise and Capella).
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@cb-analytics-mcplist all datasets in the analytics cluster"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
cb-analytics-mcp
A standalone MCP (Model Context Protocol) server plus admin GUI for Couchbase Enterprise Analytics and Couchbase Capella Analytics. Connects to Claude (claude.ai, Claude Desktop, Claude Code) and exposes the full Analytics REST surface as 55 well-typed, audited tools.
© 2026 Chris Ahrendt — MIT licensed
What you get
55 MCP tools spanning query execution, schema introspection, ingestion control, link management, UDF libraries, RBAC, cluster admin, and Capella cloud management.
Paginated queries for large result sets, with TTL caching for repeated reads, an
explain_querytool for plan investigation, and a configurable soft cap on full-result queries (default 1000 rows; truncated responses includetruncated: trueandfull_row_count).Rate limiting per API key, per tool category (10 query/sec, 60 read/sec, 1 write/sec by default) so a runaway client can't melt your cluster.
Multi-cluster support out of the box (one process, many Couchbase clusters).
Bundled web GUI at
:8080with login, SQL++ editor, paginated audit-log viewer with date / tool / failure filters, per-cluster Test Connection buttons, config explorer, and live log tail (WebSocket-streamed, with HTMX polling fallback).CLI for testing tools without a running server (
cb-analytics-mcp tools call <name> --offline) or against a remote one (--remote URL).Structured logging + audit trail + Prometheus metrics + OpenTelemetry tracing — all opt-in but on by default for the basics. Audit log rotates at 10 MB by default and keeps 5 generations.
Hardened HTTP client with retry, exponential backoff, async-native circuit breaker, and consistent error mapping.
Strict scans — every release passes pyflakes, ruff, mypy strict, bandit, and pytest with 94 %+ coverage.
Related MCP server: Couchbase-Analytics-MCP
Quickstart
# 1. Clone and install
git clone https://github.com/celticht32/cb-analytics-mcp
cd cb-analytics-mcp
make dev
# 2. Configure
cp .env.example .env
$EDITOR .env # set MCP_API_KEY, CB_ANALYTICS_HOST, etc.
# 3. Run
make run # starts MCP server on :8000 + GUI on :8080Then open http://localhost:8080 in a browser, or point Claude at
http://localhost:8000/mcp with the bearer token you set as MCP_API_KEY.
For reproducible builds in CI / Docker, install from the locked
requirements.txt instead of pyproject.toml:
pip install -r requirements.txt
pip install --no-deps -e .Contributors can opt in to pre-commit hooks (ruff, mypy, bandit run on every commit):
pip install pre-commit && pre-commit installDocumentation
Project layout
cb-analytics-mcp/
├── src/cb_analytics_mcp/
│ ├── auth.py # bearer-token verifier
│ ├── config.py # env-driven config loader
│ ├── pool.py # connection pool (clusters + Capella)
│ ├── server.py # FastMCP wire-up
│ ├── __main__.py # entrypoint (server / GUI / --check)
│ ├── couchbase/ # internal HTTP client (no SDK dep)
│ ├── observability/ # logging, audit, metrics, tracing
│ ├── tools/ # 10 modules × 55 MCP tools
│ └── gui/ # FastAPI + HTMX admin GUI
├── tests/unit/ # 411 unit tests, mocked I/O
├── docs/ # MkDocs-ready Markdown
├── .claude/skills/ # 8 Claude Code skills
├── scripts/ # deep_scan.sh, make_screenshots.py
└── pyproject.tomlMake targets
target | description |
| Install with dev extras (pytest, ruff, mypy, bandit, playwright) |
| Run MCP server + GUI |
| Run just the GUI |
| Run unit tests |
| Tests with HTML coverage report, 95.66 % currently |
| pyflakes + ruff + mypy + bandit + tests |
| Generate documentation screenshots via Playwright |
| Build the Docker image |
Quality bar
Every release must pass make scan. Current numbers:
metric | value |
Unit tests | 519 ✓ |
Coverage | 94.04 % |
pyflakes / ruff / mypy strict / bandit / pip-audit | ✓ clean |
Python | 3.11, 3.12, 3.13 |
Future possibilities
Things that aren't built yet but would be obvious next steps. Issues and PRs welcome on any of these:
Query history in the GUI. The query editor loses your statement on page reload. A small dropdown of recent queries (in-memory only, scoped to the current GUI session) would be ergonomic. The audit log already has every executed statement; this is just surfacing it in the editor.
DDL helper tools.
create_dataverse,create_dataset,drop_dataset,create_index,drop_indexas typed tools instead of relying on Claude to compose raw SQL++. Safer, less ambiguous.Bucket / scope / collection awareness. Today's schema tools work at dataverse level, but real Couchbase deployments use buckets → scopes → collections.
list_buckets,list_scopes(bucket),list_collections(...)would help Claude navigate clusters it hasn't seen before.Integration tests against a real Couchbase. The 519 unit tests use mocks; a small
tests/integration/suite that spins upcouchbase/server:enterprise-7.6in a Docker container would catch things mocks can't (real timeouts, real auth flows, edge cases in the Analytics REST surface).Per-team / per-project API keys. Today the MCP server accepts a single bearer token. Larger deployments would want per-team tokens with their own audit attribution and RBAC scope.
Tracing across the Couchbase REST boundary. OpenTelemetry currently stops at the MCP boundary. Instrumenting the outgoing
httpxrequests would give full traces from Claude → MCP → Couchbase.Distributed rate limits / pagination state. The current implementations are in-process. Scaling out horizontally would need a shared store (Redis or similar).
Acknowledgements
This project speaks to Couchbase through its public REST API. It is not an official Couchbase product. "Couchbase" and "Couchbase Capella" are trademarks of Couchbase, Inc.
License
MIT — see LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
Governed data discovery, exact queries, decisions, simulations, and runtime utilities over MCP.
MCP server for querying and analyzing data from ad platforms, analytics tools, and spreadsheets
Query, join, profile, clean and convert CSV/JSON/Parquet with server-side DuckDB over MCP.
Build multi-tenant apps over MCP. Schemas, CRUD, deploys — access control enforced server-side.
Related MCP Servers
- AlicenseAqualityAmaintenanceSQL Server MCP server with AST-based query validation, read-only safety, schema exploration, ER diagram generation, and DBA toolkit integration (First Responder Kit, DarlingData, sp_WhoIsActive).126MIT
- AlicenseNot gradedqualityNot gradedmaintenanceA 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.-
- AlicenseNot gradedqualityFmaintenanceRead-only MCP server for SQL databases (SQL Server, Postgres, SQLite) with multi-server support and three-layer safety using AST validation and linting.MIT
- AlicenseNot gradedqualityBmaintenanceMCP server for multiple databases (PostgreSQL, MySQL, MariaDB, SQLite, MongoDB, Redis) with tools for schema inspection, querying, performance diagnostics, and safe write operations, featuring access modes, PII masking, and audit logging.Apache 2.0