An MCP server implementation of Couchbase that allows LLMs to directly interact with Couchbase clusters.
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.The MCP server can be run either from the pre built PyPI package or the source using uv.
We publish a pre built PyPI package for the MCP server.
{
"mcpServers": {
"couchbase": {
"command": "uvx",
"args": ["couchbase-mcp-server"],
"env": {
"CB_CONNECTION_STRING": "couchbases://connection-string",
"CB_USERNAME": "username",
"CB_PASSWORD": "password",
"CB_BUCKET_NAME": "bucket_name"
}
}
}
}
Note: If you have other MCP servers in use in the client, you can add it to the existing
mcpServers
object.
The MCP server can be run from the source using this repository.
git clone https://github.com/Couchbase-Ecosystem/mcp-server-couchbase.git
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"
}
}
}
}
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.
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 bucket access | Required |
CB_PASSWORD |
--password |
Password for authentication | Required |
CB_BUCKET_NAME |
--bucket-name |
Name of the bucket to access | Required |
READ_ONLY_QUERY_MODE |
--read-only-query-mode |
Prevent data modification queries | true |
MCP_TRANSPORT |
--transport |
Transport mode: stdio , streamable-http , sse |
stdio |
FASTMCP_HOST |
--host |
Host for HTTP/SSE transport modes | 127.0.0.1 |
FASTMCP_PORT |
--port |
Port for HTTP/SSE transport modes | 8000 |
Follow the steps below to use Couchbase MCP server with Claude Desktop MCP client
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.
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
Open the configuration file and add the configuration to the mcpServers
section.
Restart Claude Desktop to apply the changes.
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:
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:
Install Cursor on your machine.
In Cursor, go to Cursor > Cursor Settings > Tools & Integrations > MCP Tools. Also, checkout the docs on setting up MCP server configuration from Cursor.
Specify the same configuration. You may need to add the server configuration under a parent key of mcpServers.
Save the configuration.
You will see couchbase as an added server in MCP servers list. Refresh to see if server is enabled.
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.
Install Windsurf Editor on your machine.
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.
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.
Save the configuration.
You will see couchbase as an added server in MCP Servers list under Advanced Settings. Refresh to see if server is enabled.
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.
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.
By default, the MCP server will run on port 8000 but this can be configured using the --port
or FASTMCP_PORT
environment variable.
uvx couchbase-mcp-server --connection-string='<couchbase_connection_string>' --username='<database_username>' --password='<database_password>' --bucket-name='<couchbase_bucket_to_use>' --read-only-query-mode=true --transport=streamable-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.
{
"mcpServers": {
"couchbase-streamable-http": {
"url": "http://localhost:8000/mcp"
}
}
}
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.
By default, the MCP server will run on port 8000 but this can be configured using the --port
or FASTMCP_PORT
environment variable.
uvx couchbase-mcp-server --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:8000/sse. This can be used in MCP clients supporting SSE transport mode such as Cursor.
{
"mcpServers": {
"couchbase-sse": {
"url": "http://localhost:8000/sse"
}
}
}
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.
docker build -t mcp/couchbase .
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 --rm -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='<streamable-http|sse|stdio>' \
-e READ_ONLY_QUERY_MODE='<true|false>' \
-e FASTMCP_PORT=9001 \
-p 9001:9001 \
mcp/couchbase
The FASTMCP_PORT
environment variable is only applicable in the case of HTTP transport modes like streamable-http and sse.
The Docker image can be used in stdio
transport mode with the following configuration.
{
"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>",
"-e",
"CB_BUCKET_NAME=<bucket_name>",
"mcp/couchbase"
]
}
}
}
Notes
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.--network=<your_network>
option. The network you choose depends on your environment; the default is bridge
. For details, refer to network drivers in docker.The Couchbase MCP server can also be used as a managed server in your agentic applications via Smithery.ai.
command
field in the configuration.mcp-server-couchbase.log
.uv sync
to update the dependencies.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.
If you're interested in contributing code or setting up a development environment:
📖 See CONTRIBUTING.md for comprehensive developer setup instructions, including:
uv
# 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
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!