Couchbase MCP Server

Couchbase MCP Server

Enables AI assistants to connect to Couchbase clusters locally or via SSH tunnels, providing tools for cluster management, key-value operations, N1QL queries, and index recommendations with safety features like read-only mode and write confirmations.

Category
Visit Server

README

Couchbase MCP Server

Model Context Protocol (MCP) server that connects AI assistants and agents to Couchbase — locally or over SSH tunnels to remote clusters.

Features

Safety

  • Read-only mode (default): Blocks write operations during exploration
  • Write confirmation: Destructive tools require explicit approval
  • Tool disabling: Turn off specific tools via CB_DISABLED_TOOLS

Performance

  • HTTP wrapper: Management and query APIs with SDK fallback
  • Large result handling: Truncation and export for oversized documents and query results
  • WAN development profile: Tuned for tunneled / remote clusters

Tools (24)

Category Tools
Cluster connection test, config status, buckets, scopes, collections, health
KV get, lookup-in, upsert, insert, replace, delete
Query N1QL, cluster queries, schema inference, slow/frequent/large query analysis
Index list indexes, advisor recommendations

Prerequisites

  • Python 3.10+
  • Couchbase Server 7.0+ (local or remote)
  • jq for environment switching
  • SSH key for tunneled environments
  • An MCP client (e.g. Claude Code, Cursor)

Quick start

git clone https://github.com/nethanchowdary/couchbase-mcp-server.git
cd couchbase-mcp-server

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

cp .env.example .env
# Edit .env with your Couchbase connection details

Register with Claude Code

claude mcp add couchbase -s user \
  -e "COUCHBASE_SERVER_DIR=$(pwd)" \
  -- python -m couchbase_mcp_server.server

Restart the MCP server after config changes:

claude mcp restart couchbase

Register with Cursor

Add to your MCP config (Settings → MCP):

{
  "mcpServers": {
    "couchbase": {
      "command": "/path/to/couchbase-mcp-server/.venv/bin/python",
      "args": ["-m", "couchbase_mcp_server.server"],
      "env": {
        "COUCHBASE_SERVER_DIR": "/path/to/couchbase-mcp-server"
      }
    }
  }
}

Environment switching

Use ./switch.sh to move between local Couchbase, SSH-tunneled clusters, and direct remote hosts without hand-editing .env.

./switch.sh list              # Show environments from environments.json
./switch.sh local             # Local Couchbase
./switch.sh remote-tunnel     # Remote via SSH tunnel (example config)
./switch.sh status            # Current env + tunnel state

On first switch to an environment you will be prompted for:

  • Couchbase username and password (cached in ~/.couchbase-mcp/credentials.json, mode 600)
  • SSH username (tunnel environments only)

Then choose read-only mode and optional tool disables. Restart MCP after switching:

claude mcp restart couchbase

Configure environments

environments.json — committed example configs (local, remote-tunnel, remote-multinode, remote-direct). Edit hostnames and tunnel targets for your setup.

environments.local.json — optional, gitignored. Copy from environments.local.json.example for private clusters you do not want in git. Entries are merged on top of environments.json.

cp environments.local.json.example environments.local.json
# Edit with your real bastion hosts and node addresses

Credential management

./switch.sh credentials list
./switch.sh credentials clear remote-tunnel
./switch.sh credentials clear-all

Configuration reference

Variable Required Description
CB_CONNECTION_STRING Yes e.g. couchbase://localhost
CB_USERNAME Yes Couchbase user
CB_PASSWORD Yes Couchbase password
CB_READ_ONLY_MODE No Default true
CB_DISABLED_TOOLS No Comma-separated tool names
CB_TIMEOUT_SECONDS No Connection timeout
CB_CA_CERT_PATH No TLS CA cert
CB_CLIENT_CERT_PATH No mTLS client cert
CB_CLIENT_KEY_PATH No mTLS client key
LOG_LEVEL No Default INFO
COUCHBASE_SERVER_DIR No Project root for .env discovery

See .env.example for the full list.

SSH tunnels

tunnel-manager.sh handles single-node and multi-node tunnels. Multi-node setups may require localhost aliases on macOS:

sudo ifconfig lo0 alias 127.0.0.2 up

Test tunnel connectivity:

./switch.sh remote-tunnel --test
curl -u user:pass http://127.0.0.1:8091/pools/default

Development

source .venv/bin/activate
pip install -e ".[dev]"
pytest
ruff check src tests

Or use the wrapper:

./run_mcp_server.sh

Security notes for public repos

  • Never commit .env, environments.local.json, or credential files
  • Rotate any Couchbase or SSH credentials that were ever committed or shared
  • VITE_*-style exposure does not apply here (server-side env), but .env is still regenerated by switch.sh with passwords — keep it gitignored
  • Use read-only Couchbase users when exploring production-like data

Project layout

src/couchbase_mcp_server/   # MCP server and tools
lib/credentials.sh          # Credential cache helpers
switch.sh                   # Environment switcher
tunnel-manager.sh           # SSH tunnel lifecycle
environments.json           # Example environment definitions
tests/

License

MIT (add a LICENSE file if you publish publicly).

Recommended Servers

playwright-mcp

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured