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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。