cb-analytics-mcp

cb-analytics-mcp

A standalone MCP server plus admin GUI for Couchbase Enterprise Analytics and Couchbase Capella Analytics, exposing 55 well-typed, audited tools for query execution, schema introspection, and cluster management.

Category
访问服务器

README

cb-analytics-mcp

CI Coverage License: MIT Python: 3.11+

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_query tool for plan investigation, and a configurable soft cap on full-result queries (default 1000 rows; truncated responses include truncated: true and full_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 :8080 with 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.

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 :8080

Then 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 install

Documentation

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

Make targets

target description
make dev Install with dev extras (pytest, ruff, mypy, bandit, playwright)
make run Run MCP server + GUI
make gui Run just the GUI
make test Run unit tests
make coverage Tests with HTML coverage report, 95.66 % currently
make scan pyflakes + ruff + mypy + bandit + tests
make screenshots Generate documentation screenshots via Playwright
make docker 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_index as 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 up couchbase/server:enterprise-7.6 in 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 httpx requests 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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选