Couchbase MCP Server

Couchbase MCP Server

Enable LLMs to interact directly with Couchbase clusters via the Model Context Protocol.

24
Stars
28
Forks
24
Watchers
5
Issues
Couchbase MCP Server provides an MCP-compliant server for connecting Large Language Models to Couchbase clusters. It supports various database operations such as bucket and collection listing, document retrieval, upsert, and deletion, as well as running SQL++ queries and retrieving index information. Designed for easy integration with MCP clients like Claude Desktop, it includes features for secure authentication and query mode configuration. The server can be deployed using a prebuilt PyPI package or directly from source.

Key Features

Lists all buckets within a Couchbase cluster
Displays scopes and collections in specified buckets
Fetches structure and schema details for collections
Performs document retrieval, upsert, and deletion by ID
Executes SQL++ queries with configurable read-only option
Shows MCP server and Couchbase cluster health status
Validates cluster credentials
Lists all indexes and their definitions with filtering options
Provides index recommendations to optimize query performance
Supports both basic authentication and mTLS for connections

Use Cases

Allowing LLMs to browse and query Couchbase databases for intelligent data access
Automating database management tasks with natural language through LLMs
Integrating Couchbase operations into AI model workflows via MCP clients
Performing data exploration and rapid prototyping against Couchbase clusters
Optimizing query strategies using index recommendation features
Monitoring Couchbase clusters and services through a standardized protocol
Seamless document CRUD operations powered by LLMs
Enabling secure, authenticated access to Couchbase for AI systems
Supporting advanced conversational agents with live database interaction
Facilitating database administration tasks through AI-driven interfaces

README

Couchbase MCP Server

An MCP server implementation of Couchbase that allows LLMs to directly interact with Couchbase clusters.

License Python 3.10+ PyPI version Verified on MseeP Trust Score

Features

  • Get a list of all the buckets in the cluster
  • Get a list of all the scopes and collections in the specified bucket
  • Get a list of all the scopes in the specified bucket
  • Get a list of all the collections in a specified scope and bucket. Note that this tool requires the cluster to have Query service.
  • Get the structure for a collection
  • Get a document by ID from a specified scope and collection
  • Upsert a document by ID to a specified scope and collection
  • Delete a document by ID from a specified scope and collection
  • Run a SQL++ query on a specified scope
    • There is an option in the MCP server, CB_MCP_READ_ONLY_QUERY_MODE that is set to true by default to disable running SQL++ queries that change the data or the underlying collection structure. Note that the documents can still be updated by ID.
  • Get the status of the MCP server
  • Check the cluster credentials by connecting to the cluster
  • List all indexes in the cluster with their definitions, with optional filtering by bucket, scope, collection and index name.
  • Get index recommendations from Couchbase Index Advisor for a given SQL++ query to optimize query performance
  • Get cluster health status and list of all running services

Prerequisites

  • Python 3.10 or higher.
  • A running Couchbase cluster. The easiest way to get started is to use Capella free tier, which is fully managed version of Couchbase server. You can follow instructions to import one of the sample datasets or import your own.
  • uv installed to run the server.
  • An MCP client such as Claude Desktop installed to connect the server to Claude. The instructions are provided for Claude Desktop and Cursor. Other MCP clients could be used as well.

Configuration

The MCP server can be run either from the prebuilt PyPI package or the source using uv.

Running from PyPI

We publish a pre built PyPI package for the MCP server.

Server Configuration using Pre built Package for MCP Clients

Basic Authentication

json
{
  "mcpServers": {
    "couchbase": {
      "command": "uvx",
      "args": ["couchbase-mcp-server"],
      "env": {
        "CB_CONNECTION_STRING": "couchbases://connection-string",
        "CB_USERNAME": "username",
        "CB_PASSWORD": "password"
      }
    }
  }
}

or

mTLS

json
{
  "mcpServers": {
    "couchbase": {
      "command": "uvx",
      "args": ["couchbase-mcp-server"],
      "env": {
        "CB_CONNECTION_STRING": "couchbases://connection-string",
        "CB_CLIENT_CERT_PATH": "/path/to/client-certificate.pem",
        "CB_CLIENT_KEY_PATH": "/path/to/client.key"
      }
    }
  }
}

Note: If you have other MCP servers in use in the client, you can add it to the existing mcpServers object.

Running from Source

The MCP server can be run from the source using this repository.

Clone the repository to your local machine.

bash
git clone https://github.com/Couchbase-Ecosystem/mcp-server-couchbase.git

Server Configuration using Source for MCP Clients

This is the common configuration for the MCP clients such as Claude Desktop, Cursor, Windsurf Editor.

json
{
  "mcpServers": {
    "couchbase": {
      "command": "uv",
      "args": [
        "--directory",
        "path/to/cloned/repo/mcp-server-couchbase/",
        "run",
        "src/mcp_server.py"
      ],
      "env": {
        "CB_CONNECTION_STRING": "couchbases://connection-string",
        "CB_USERNAME": "username",
        "CB_PASSWORD": "password"
      }
    }
  }
}

Note: path/to/cloned/repo/mcp-server-couchbase/ should be the path to the cloned repository on your local machine. Don't forget the trailing slash at the end!

Note: If you have other MCP servers in use in the client, you can add it to the existing mcpServers object.

Additional Configuration for MCP Server

The server can be configured using environment variables or command line arguments:

Environment Variable CLI Argument Description Default
CB_CONNECTION_STRING --connection-string Connection string to the Couchbase cluster Required
CB_USERNAME --username Username with access to required buckets for basic authentication Required (or Client Certificate and Key needed for mTLS)
CB_PASSWORD --password Password for basic authentication Required (or Client Certificate and Key needed for mTLS)
CB_CLIENT_CERT_PATH --client-cert-path Path to the client certificate file for mTLS authentication Required if using mTLS (or Username and Password required)
CB_CLIENT_KEY_PATH --client-key-path Path to the client key file for mTLS authentication Required if using mTLS (or Username and Password required)
CB_CA_CERT_PATH --ca-cert-path Path to server root certificate for TLS if server is configured with a self-signed/untrusted certificate. This will not be required if you are connecting to Capella
CB_MCP_READ_ONLY_QUERY_MODE --read-only-query-mode Prevent data modification queries true
CB_MCP_TRANSPORT --transport Transport mode: stdio, http, sse stdio
CB_MCP_HOST --host Host for HTTP/SSE transport modes 127.0.0.1
CB_MCP_PORT --port Port for HTTP/SSE transport modes 8000

Note: For authentication, you need either the Username and Password or the Client Certificate and key paths. Optionally, you can specify the CA root certificate path that will be used to validate the server certificates. If both the Client Certificate & key path and the username and password are specified, the client certificates will be used for authentication.

You can also check the version of the server using:

bash
uvx couchbase-mcp-server --version

Client Specific Configuration

Follow the steps below to use Couchbase MCP server with Claude Desktop MCP client

  1. The MCP server can now be added to Claude Desktop by editing the configuration file. More detailed instructions can be found on the MCP quickstart guide.

    • On Mac, the configuration file is located at ~/Library/Application Support/Claude/claude_desktop_config.json
    • On Windows, the configuration file is located at %APPDATA%\Claude\claude_desktop_config.json

    Open the configuration file and add the configuration to the mcpServers section.

  2. Restart Claude Desktop to apply the changes.

  3. You can now use the server in Claude Desktop to run queries on the Couchbase cluster using natural language and perform CRUD operations on documents.

Logs

The logs for Claude Desktop can be found in the following locations:

  • MacOS: ~/Library/Logs/Claude
  • Windows: %APPDATA%\Claude\Logs

The logs can be used to diagnose connection issues or other problems with your MCP server configuration. For more details, refer to the official documentation.

Follow steps below to use Couchbase MCP server with Cursor:

  1. Install Cursor on your machine.

  2. In Cursor, go to Cursor > Cursor Settings > Tools & Integrations > MCP Tools. Also, checkout the docs on setting up MCP server configuration from Cursor.

  3. Specify the same configuration. You may need to add the server configuration under a parent key of mcpServers.

  4. Save the configuration.

  5. You will see couchbase as an added server in MCP servers list. Refresh to see if server is enabled.

  6. You can now use the Couchbase MCP server in Cursor to query your Couchbase cluster using natural language and perform CRUD operations on documents.

For more details about MCP integration with Cursor, refer to the official Cursor MCP documentation.

Logs

In the bottom panel of Cursor, click on "Output" and select "Cursor MCP" from the dropdown menu to view server logs. This can help diagnose connection issues or other problems with your MCP server configuration.

Follow the steps below to use the Couchbase MCP server with Windsurf Editor.

  1. Install Windsurf Editor on your machine.

  2. In Windsurf Editor, navigate to Command Palette > Windsurf MCP Configuration Panel or Windsurf - Settings > Advanced > Cascade > Model Context Protocol (MCP) Servers. For more details on the configuration, please refer to the official documentation.

  3. Click on Add Server and then Add custom server. On the configuration that opens in the editor, add the Couchbase MCP Server configuration from above.

  4. Save the configuration.

  5. You will see couchbase as an added server in MCP Servers list under Advanced Settings. Refresh to see if server is enabled.

  6. You can now use the Couchbase MCP server in Windsurf Editor to query your Couchbase cluster using natural language and perform CRUD operations on documents.

For more details about MCP integration with Windsurf Editor, refer to the official Windsurf MCP documentation.

Streamable HTTP Transport Mode

The MCP Server can be run in Streamable HTTP transport mode which allows multiple clients to connect to the same server instance via HTTP. Check if your MCP client supports streamable http transport before attempting to connect to MCP server in this mode.

Note: This mode does not include authorization support.

Usage

By default, the MCP server will run on port 8000 but this can be configured using the --port or CB_MCP_PORT environment variable.

bash
uvx couchbase-mcp-server \
  --connection-string='<couchbase_connection_string>' \
  --username='<database_username>' \
  --password='<database_password>' \
  --read-only-query-mode=true \
  --transport=http

The server will be available on http://localhost:8000/mcp. This can be used in MCP clients supporting streamable http transport mode such as Cursor.

MCP Client Configuration

json
{
  "mcpServers": {
    "couchbase-http": {
      "url": "http://localhost:8000/mcp"
    }
  }
}

SSE Transport Mode

There is an option to run the MCP server in Server-Sent Events (SSE) transport mode.

Note: SSE mode has been deprecated by MCP. We have support for Streamable HTTP.

Usage

By default, the MCP server will run on port 8000 but this can be configured using the --port or CB_MCP_PORT environment variable.

bash
uvx couchbase-mcp-server \
  --connection-string='<couchbase_connection_string>' \
  --username='<database_username>' \
  --password='<database_password>' \
  --read-only-query-mode=true \
  --transport=sse

The server will be available on http://localhost:8000/sse. This can be used in MCP clients supporting SSE transport mode such as Cursor.

MCP Client Configuration

json
{
  "mcpServers": {
    "couchbase-sse": {
      "url": "http://localhost:8000/sse"
    }
  }
}

Docker Image

The MCP server can also be built and run as a Docker container. Prebuilt images can be found on DockerHub.

Alternatively, we are part of the Docker MCP Catalog.

Building Image

bash
docker build -t mcp/couchbase .
bash
docker build --build-arg GIT_COMMIT_HASH=$(git rev-parse HEAD) \
  --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
  -t mcp/couchbase .

Alternatively, use the provided build script:

bash
./build.sh

This script automatically:

  • Generates git commit hash and build timestamp
  • Creates multiple useful tags (latest, <short-commit>)
  • Shows build information and results
  • Uses the same arguments as CI/CD builds

Verify image labels:

bash
# View git commit hash in image
docker inspect --format='{{index .Config.Labels "org.opencontainers.image.revision"}}' mcp/couchbase:latest

# View all metadata labels
docker inspect --format='{{json .Config.Labels}}' mcp/couchbase:latest

Running

The MCP server can be run with the environment variables being used to configure the Couchbase settings. The environment variables are the same as described in the Configuration section.

Independent Docker Container

bash
docker run --rm -i \
  -e CB_CONNECTION_STRING='<couchbase_connection_string>' \
  -e CB_USERNAME='<database_user>' \
  -e CB_PASSWORD='<database_password>' \
  -e CB_MCP_TRANSPORT='<http|sse|stdio>' \
  -e CB_MCP_READ_ONLY_QUERY_MODE='<true|false>' \
  -e CB_MCP_PORT=9001 \
  -p 9001:9001 \
  mcp/couchbase

The CB_MCP_PORT environment variable is only applicable in the case of HTTP transport modes like http and sse.

MCP Client Configuration

The Docker image can be used in stdio transport mode with the following configuration.

json
{
  "mcpServers": {
    "couchbase-mcp-docker": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "CB_CONNECTION_STRING=<couchbase_connection_string>",
        "-e",
        "CB_USERNAME=<database_user>",
        "-e",
        "CB_PASSWORD=<database_password>",
        "mcp/couchbase"
      ]
    }
  }
}

Notes

  • The couchbase_connection_string value depends on whether the Couchbase server is running on the same host machine, in another Docker container, or on a remote host. If your Couchbase server is running on your host machine, your connection string would likely be of the form couchbase://host.docker.internal. For details refer to the docker documentation.
  • You can specify the container's networking using the --network=<your_network> option. The network you choose depends on your environment; the default is bridge. For details, refer to network drivers in docker.

Risks Associated with LLMs

  • The use of large language models and similar technology involves risks, including the potential for inaccurate or harmful outputs.
  • Couchbase does not review or evaluate the quality or accuracy of such outputs, and such outputs may not reflect Couchbase's views.
  • You are solely responsible for determining whether to use large language models and related technology, and for complying with any license terms, terms of use, and your organization's policies governing your use of the same.

Managed MCP Server

The Couchbase MCP server can also be used as a managed server in your agentic applications via Smithery.ai.

Troubleshooting Tips

  • Ensure the path to your MCP server repository is correct in the configuration if running from source.
  • Verify that your Couchbase connection string, database username, password or the path to the certificates are correct.
  • If using Couchbase Capella, ensure that the cluster is accessible from the machine where the MCP server is running.
  • Check that the database user has proper permissions to access at least one bucket.
  • Confirm that the uv package manager is properly installed and accessible. You may need to provide absolute path to uv/uvx in the command field in the configuration.
  • Check the logs for any errors or warnings that may indicate issues with the MCP server. The location of the logs depend on your MCP client.
  • If you are observing issues running your MCP server from source after updating your local MCP server repository, try running uv sync to update the dependencies.

👩‍💻 Contributing

We welcome contributions from the community! Whether you want to fix bugs, add features, or improve documentation, your help is appreciated.

If you need help, have found a bug, or want to contribute improvements, the best place to do that is right here — by opening a GitHub issue.

For Developers

If you're interested in contributing code or setting up a development environment:

📖 See CONTRIBUTING.md for comprehensive developer setup instructions, including:

  • Development environment setup with uv
  • Code linting and formatting with Ruff
  • Pre-commit hooks installation
  • Project structure overview
  • Development workflow and practices

Quick Start for Contributors

bash
# Clone and setup
git clone https://github.com/Couchbase-Ecosystem/mcp-server-couchbase.git
cd mcp-server-couchbase

# Install with development dependencies
uv sync --extra dev

# Install pre-commit hooks
uv run pre-commit install

# Run linting
./scripts/lint.sh

📢 Support Policy

We truly appreciate your interest in this project! This project is Couchbase community-maintained, which means it's not officially supported by our support team. However, our engineers are actively monitoring and maintaining this repo and will try to resolve issues on a best-effort basis.

Our support portal is unable to assist with requests related to this project, so we kindly ask that all inquiries stay within GitHub.

Your collaboration helps us all move forward together — thank you!

Star History

Star History Chart

Repository Owner

Couchbase-Ecosystem
Couchbase-Ecosystem

Organization

Repository Details

Language Python
Default Branch main
Size 365 KB
Contributors 12
License Apache License 2.0
MCP Verified Nov 12, 2025

Programming Languages

Python
92.65%
Dockerfile
3.79%
Shell
3.57%

Tags

Topics

couchbase hacktoberfest mcp

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • MongoDB MCP Server

    MongoDB MCP Server

    A Model Context Protocol server for enabling LLM interaction with MongoDB databases.

    MongoDB MCP Server empowers language models to interface directly with MongoDB databases using the Model Context Protocol (MCP). It enables natural language querying and management of collections, documents, and indexes. Users can inspect database schemas, execute document operations, and manage indexes seamlessly. The tool integrates with clients like Claude Desktop for conversational database management.

    • 172
    • MCP
    • QuantGeekDev/mongo-mcp
  • YDB MCP

    YDB MCP

    MCP server for AI-powered natural language database operations on YDB.

    YDB MCP acts as a Model Context Protocol server enabling YDB databases to be accessed via any LLM supporting MCP. It allows AI-driven and natural language interaction with YDB instances by bridging database operations with language model interfaces. Flexible deployment through uvx, pipx, or pip is supported, along with multiple authentication methods. The integration empowers users to manage YDB databases conversationally through standardized protocols.

    • 24
    • MCP
    • ydb-platform/ydb-mcp
  • MCP MongoDB Server

    MCP MongoDB Server

    A Model Context Protocol server for LLM interaction with MongoDB databases.

    MCP MongoDB Server enables large language models to interact with MongoDB databases through the standardized Model Context Protocol interface. It provides schema inspection, document querying, aggregation, and write operations with intelligent ObjectId handling and flexible read-only configurations. Designed for seamless integration with tools like Claude Desktop, it offers collection completions, schema inference, and robust support for both development and production environments.

    • 267
    • MCP
    • kiliczsh/mcp-mongo-server
  • Hydrolix MCP Server

    Hydrolix MCP Server

    MCP server for secure, efficient SQL access to Hydrolix clusters.

    Hydrolix MCP Server provides a Model Context Protocol (MCP) interface for executing SQL queries, listing databases, and listing tables on Hydrolix clusters. It ensures safe, read-only data access and includes a standardized health-check endpoint. The server integrates easily with various MCP-compatible clients, supporting multiple authentication methods using either credentials or service account tokens.

    • 5
    • MCP
    • hydrolix/mcp-hydrolix
  • Supabase MCP Server

    Supabase MCP Server

    Connect Supabase projects to AI assistants using the Model Context Protocol.

    Supabase MCP Server enables direct, secure integration between Supabase projects and AI assistants such as Cursor, Claude, and Windsurf. Leveraging the Model Context Protocol, it provides standardized endpoints for external LLMs to perform tasks like managing tables, fetching configurations, and querying data on Supabase. The server supports OAuth 2.1 Dynamic Client Registration and offers easy setup with feature groups and popular client installers for local, cloud, and self-hosted environments.

    • 2,263
    • MCP
    • supabase-community/supabase-mcp
  • MCP Toolbox for Databases

    MCP Toolbox for Databases

    Open source MCP server for secure and efficient Gen AI database integrations.

    MCP Toolbox for Databases is an open source server that implements the Model Context Protocol (MCP) for database interactions in Gen AI workflows. It manages core complexities such as connection pooling, authentication, and tool integration, enabling developers to create and deploy database tools with ease and enhanced security. The toolbox supports streamlined connections between development environments and databases, offering observability, context-aware code generation, and automation features. Its design emphasizes rapid integration, reusable tools, and compatibility with AI assistants.

    • 11,412
    • MCP
    • googleapis/genai-toolbox
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results