Sponsored by Deepsite.site

Couchbase MCP Server

Created By
Couchbase-Ecosystem9 months ago
MCP Server to interact with data in Couchbase Clusters
Content

Couchbase MCP Server

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

Features

  • Get a list of all the scopes and collections in the specified bucket
  • 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, 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.

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

Clone the repository to your local machine.

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

Server Configuration for MCP Clients

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

{
  "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",
        "CB_BUCKET_NAME": "bucket_name"
      }
    }
  }
}

The server can be configured using environment variables. The following variables are supported:

  • CB_CONNECTION_STRING: The connection string to the Couchbase cluster
  • CB_USERNAME: The username with access to the bucket to use to connect
  • CB_PASSWORD: The password for the username to connect
  • CB_BUCKET_NAME: The name of the bucket that the server will access
  • READ_ONLY_QUERY_MODE: Setting to configure whether SQL++ queries that allow data to be modified are allowed. It is set to True by default.
  • 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.

Claude Desktop

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.

Claude Desktop 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.

Cursor

Follow steps below to use Couchbase MCP server with Cursor:

  1. Install Cursor on your machine.

  2. In Cursor, go to Cursor > Cursor Settings > MCP > Add a new global MCP server. 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.

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

Windsurf Editor

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.

SSE Server Mode

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

Usage

By default, the MCP server will run on port 8080 but this can be configured using the FASTMCP_PORT environment variable.

uv run src/mcp_server.py --connection-string='<couchbase_connection_string>' --username='<database_username>' --password='<database_password>' --bucket-name='<couchbase_bucket_to_use>' --read-only-query-mode=true --transport=sse

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

Docker Image

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

docker build -t mcp/couchbase .

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

docker run -i \
  -e CB_CONNECTION_STRING='<couchbase_connection_string>' \
  -e CB_USERNAME='<database_user>' \
  -e CB_PASSWORD='<database_password>' \
  -e CB_BUCKET_NAME='<bucket_name>' \
  -e MCP_TRANSPORT='stdio/sse' \
  -e READ_ONLY_QUERY_MODE="true/false" \
  mcp/couchbase

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.
  • Verify that your Couchbase connection string, database username, password and bucket name 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 the specified bucket.
  • Confirm that the uv package manager is properly installed and accessible. You may need to provide absolute path to uv in the command field in the configuration.
  • Check the logs for any errors or warnings that may indicate issues with the MCP server. The server logs are under the name, mcp-server-couchbase.log.

📢 Support Policy

We truly appreciate your interest in this project!
This project is community-maintained, which means it's not officially supported by our support team.

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

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Tavily Mcp
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Amap Maps高德地图官方 MCP Server
ChatWiseThe second fastest AI chatbot™
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Serper MCP ServerA Serper MCP Server
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Playwright McpPlaywright MCP server
CursorThe AI Code Editor
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
WindsurfThe new purpose-built IDE to harness magic
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
DeepChatYour AI Partner on Desktop