couchbase-mcp-server 0.5.3__tar.gz → 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/.github/workflows/test.yml +42 -30
- couchbase_mcp_server-0.6.0/DOCKER.md +194 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/PKG-INFO +217 -31
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/README.md +215 -30
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/pyproject.toml +2 -1
- couchbase_mcp_server-0.6.0/scripts/setup_test_data.py +458 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/server.json +3 -3
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/src/mcp_server.py +54 -6
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/src/tools/__init__.py +50 -6
- couchbase_mcp_server-0.6.0/src/tools/kv.py +143 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/src/tools/query.py +7 -2
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/src/tools/server.py +1 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/src/utils/__init__.py +2 -0
- couchbase_mcp_server-0.6.0/src/utils/config.py +89 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/src/utils/context.py +11 -1
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/tests/conftest.py +21 -0
- couchbase_mcp_server-0.6.0/tests/test_disabled_tools.py +264 -0
- couchbase_mcp_server-0.6.0/tests/test_kv_tools.py +481 -0
- couchbase_mcp_server-0.6.0/tests/test_read_only_mode.py +275 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/uv.lock +95 -1
- couchbase_mcp_server-0.5.3/DOCKER.md +0 -87
- couchbase_mcp_server-0.5.3/src/tools/kv.py +0 -80
- couchbase_mcp_server-0.5.3/src/utils/config.py +0 -13
- couchbase_mcp_server-0.5.3/tests/test_kv_tools.py +0 -217
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/.github/workflows/alert-on-pr.yml +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/.github/workflows/docker.yml +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/.github/workflows/release.yml +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/.github/workflows/test_release.yml +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/.github/workflows/update-mcp-registry.yml +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/.gitignore +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/.pre-commit-config.yaml +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/CONTRIBUTING.md +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/Dockerfile +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/LICENSE +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/RELEASE.md +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/build.sh +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/glama.json +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/scripts/lint.sh +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/scripts/lint_fix.sh +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/scripts/update_version.sh +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/smithery.yaml +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/src/certs/__init__.py +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/src/certs/capella_root_ca.pem +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/src/tools/index.py +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/src/utils/connection.py +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/src/utils/constants.py +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/src/utils/index_utils.py +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/tests/test_index_tools.py +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/tests/test_mcp_integration.py +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/tests/test_performance_tools.py +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/tests/test_query_tools.py +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/tests/test_server_tools.py +0 -0
- {couchbase_mcp_server-0.5.3 → couchbase_mcp_server-0.6.0}/tests/test_utils.py +0 -0
|
@@ -100,54 +100,60 @@ jobs:
|
|
|
100
100
|
|
|
101
101
|
echo "Cluster initialization complete"
|
|
102
102
|
|
|
103
|
-
- name:
|
|
103
|
+
- name: Load travel-sample bucket
|
|
104
104
|
run: |
|
|
105
|
-
echo "
|
|
105
|
+
echo "Loading travel-sample bucket..."
|
|
106
106
|
|
|
107
107
|
# Wait for cluster to be fully initialized
|
|
108
108
|
sleep 5
|
|
109
109
|
|
|
110
|
-
#
|
|
111
|
-
curl -s -X POST http://localhost:8091/
|
|
110
|
+
# Load the travel-sample sample bucket (includes inventory scope with airline, route, hotel, airport collections)
|
|
111
|
+
curl -s -X POST http://localhost:8091/sampleBuckets/install \
|
|
112
112
|
-u "${{ env.CB_USERNAME }}:${{ env.CB_PASSWORD }}" \
|
|
113
|
-
-
|
|
114
|
-
-d '
|
|
115
|
-
-d 'ramQuota=256' \
|
|
116
|
-
-d 'flushEnabled=1'
|
|
113
|
+
-H "Content-Type: application/json" \
|
|
114
|
+
-d '["travel-sample"]'
|
|
117
115
|
|
|
118
|
-
# Wait for bucket to be ready
|
|
119
|
-
echo "Waiting for bucket to be ready..."
|
|
120
|
-
for i in {1..
|
|
116
|
+
# Wait for bucket to be ready (sample buckets take longer to load)
|
|
117
|
+
echo "Waiting for travel-sample bucket to be ready..."
|
|
118
|
+
for i in {1..60}; do
|
|
121
119
|
if curl -s -u "${{ env.CB_USERNAME }}:${{ env.CB_PASSWORD }}" \
|
|
122
|
-
http://localhost:8091/pools/default/buckets
|
|
120
|
+
http://localhost:8091/pools/default/buckets/travel-sample 2>/dev/null | grep -q '"status":"healthy"'; then
|
|
123
121
|
echo "Bucket is healthy"
|
|
124
122
|
break
|
|
125
123
|
fi
|
|
126
|
-
echo "Waiting for bucket... ($i/
|
|
127
|
-
sleep
|
|
124
|
+
echo "Waiting for bucket... ($i/60)"
|
|
125
|
+
sleep 3
|
|
128
126
|
done
|
|
129
127
|
|
|
130
|
-
|
|
128
|
+
# Additional wait for data to be fully loaded
|
|
129
|
+
echo "Waiting for sample data to be fully loaded..."
|
|
130
|
+
sleep 10
|
|
131
|
+
|
|
132
|
+
- name: Set indexer storage mode
|
|
131
133
|
run: |
|
|
132
|
-
echo "
|
|
134
|
+
echo "Setting indexer storage mode..."
|
|
135
|
+
# Wait for indexer service to be ready
|
|
133
136
|
sleep 5
|
|
134
|
-
|
|
137
|
+
# Set storage mode to plasma (Couchbase 7.1+)
|
|
138
|
+
# Use cluster settings API which is more reliable
|
|
139
|
+
curl -s -X POST http://localhost:8091/settings/indexes \
|
|
135
140
|
-u "${{ env.CB_USERNAME }}:${{ env.CB_PASSWORD }}" \
|
|
136
|
-
-d
|
|
137
|
-
|| echo "
|
|
141
|
+
-d 'storageMode=plasma' \
|
|
142
|
+
|| echo "Storage mode may already be set or indexer not ready"
|
|
143
|
+
# Wait for storage mode to be applied
|
|
144
|
+
echo "Waiting for storage mode to be applied..."
|
|
145
|
+
sleep 5
|
|
138
146
|
|
|
139
|
-
- name:
|
|
147
|
+
- name: Setup test data (indexes and queries)
|
|
148
|
+
env:
|
|
149
|
+
CB_CONNECTION_STRING: couchbase://localhost
|
|
150
|
+
CB_USERNAME: ${{ env.CB_USERNAME }}
|
|
151
|
+
CB_PASSWORD: ${{ env.CB_PASSWORD }}
|
|
152
|
+
CB_MCP_TEST_BUCKET: ${{ env.CB_MCP_TEST_BUCKET }}
|
|
153
|
+
PYTHONPATH: src
|
|
140
154
|
run: |
|
|
141
|
-
echo "
|
|
142
|
-
|
|
143
|
-
-u "${{ env.CB_USERNAME }}:${{ env.CB_PASSWORD }}" \
|
|
144
|
-
-d "statement=INSERT INTO \`${{ env.CB_MCP_TEST_BUCKET }}\`._default._default (KEY, VALUE) VALUES {\"type\": \"test\", \"name\": \"Test Document 1\", \"id\": 1})" \
|
|
145
|
-
|| echo "Insert may have failed"
|
|
146
|
-
|
|
147
|
-
curl -s -X POST http://localhost:8093/query/service \
|
|
148
|
-
-u "${{ env.CB_USERNAME }}:${{ env.CB_PASSWORD }}" \
|
|
149
|
-
-d "statement=INSERT INTO \`${{ env.CB_MCP_TEST_BUCKET }}\`._default._default (KEY, VALUE) VALUES ('test-doc-2', {\"type\": \"test\", \"name\": \"Test Document 2\", \"id\": 2})" \
|
|
150
|
-
|| echo "Insert may have failed"
|
|
155
|
+
echo "Running setup_test_data.py to create indexes and populate test data..."
|
|
156
|
+
uv run python scripts/setup_test_data.py
|
|
151
157
|
|
|
152
158
|
# ============================================
|
|
153
159
|
# STDIO Transport Tests
|
|
@@ -157,6 +163,8 @@ jobs:
|
|
|
157
163
|
env:
|
|
158
164
|
CB_CONNECTION_STRING: couchbase://localhost
|
|
159
165
|
CB_MCP_TRANSPORT: stdio
|
|
166
|
+
CB_MCP_TEST_SCOPE: inventory
|
|
167
|
+
CB_MCP_TEST_COLLECTION: airline
|
|
160
168
|
PYTHONPATH: src
|
|
161
169
|
run: |
|
|
162
170
|
echo "Running tests with STDIO transport..."
|
|
@@ -198,6 +206,8 @@ jobs:
|
|
|
198
206
|
CB_MCP_HOST: 127.0.0.1
|
|
199
207
|
CB_MCP_PORT: 8000
|
|
200
208
|
MCP_SERVER_URL: http://127.0.0.1:8000/mcp
|
|
209
|
+
CB_MCP_TEST_SCOPE: inventory
|
|
210
|
+
CB_MCP_TEST_COLLECTION: airline
|
|
201
211
|
PYTHONPATH: src
|
|
202
212
|
run: |
|
|
203
213
|
echo "Running tests with HTTP transport..."
|
|
@@ -246,6 +256,8 @@ jobs:
|
|
|
246
256
|
CB_MCP_HOST: 127.0.0.1
|
|
247
257
|
CB_MCP_PORT: 8000
|
|
248
258
|
MCP_SERVER_URL: http://127.0.0.1:8000/sse
|
|
259
|
+
CB_MCP_TEST_SCOPE: inventory
|
|
260
|
+
CB_MCP_TEST_COLLECTION: airline
|
|
249
261
|
PYTHONPATH: src
|
|
250
262
|
run: |
|
|
251
263
|
echo "Running tests with SSE transport..."
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Couchbase MCP Server
|
|
2
|
+
|
|
3
|
+
Pre-built images for the [Couchbase](https://www.couchbase.com/) MCP Server.
|
|
4
|
+
|
|
5
|
+
A Model Context Protocol (MCP) server that allows AI agents to interact with Couchbase databases.
|
|
6
|
+
|
|
7
|
+
Github Repo: https://github.com/Couchbase-Ecosystem/mcp-server-couchbase
|
|
8
|
+
|
|
9
|
+
Dockerfile: https://github.com/Couchbase-Ecosystem/mcp-server-couchbase/blob/main/Dockerfile
|
|
10
|
+
|
|
11
|
+
## Features/Tools
|
|
12
|
+
### Cluster setup & health tools
|
|
13
|
+
| Tool Name | Description |
|
|
14
|
+
|-----------|-------------|
|
|
15
|
+
| `get_server_configuration_status` | Get the status of the MCP server |
|
|
16
|
+
| `test_cluster_connection` | Check the cluster credentials by connecting to the cluster |
|
|
17
|
+
| `get_cluster_health_and_services` | Get cluster health status and list of all running services |
|
|
18
|
+
|
|
19
|
+
### Data model & schema discovery tools
|
|
20
|
+
| Tool Name | Description |
|
|
21
|
+
|-----------|-------------|
|
|
22
|
+
| `get_buckets_in_cluster` | Get a list of all the buckets in the cluster |
|
|
23
|
+
| `get_scopes_in_bucket` | Get a list of all the scopes in the specified bucket |
|
|
24
|
+
| `get_collections_in_scope` | Get a list of all the collections in a specified scope and bucket. Note that this tool requires the cluster to have Query service. |
|
|
25
|
+
| `get_scopes_and_collections_in_bucket` | Get a list of all the scopes and collections in the specified bucket |
|
|
26
|
+
| `get_schema_for_collection` | Get the structure for a collection |
|
|
27
|
+
|
|
28
|
+
### Document KV operations tools
|
|
29
|
+
| Tool Name | Description |
|
|
30
|
+
|-----------|-------------|
|
|
31
|
+
| `get_document_by_id` | Get a document by ID from a specified scope and collection |
|
|
32
|
+
| `upsert_document_by_id` | Upsert a document by ID to a specified scope and collection. **Disabled by default when `CB_MCP_READ_ONLY_MODE=true`.** |
|
|
33
|
+
| `insert_document_by_id` | Insert a new document by ID (fails if document exists). **Disabled by default when `CB_MCP_READ_ONLY_MODE=true`.** |
|
|
34
|
+
| `replace_document_by_id` | Replace an existing document by ID (fails if document doesn't exist). **Disabled by default when `CB_MCP_READ_ONLY_MODE=true`.** |
|
|
35
|
+
| `delete_document_by_id` | Delete a document by ID from a specified scope and collection. **Disabled by default when `CB_MCP_READ_ONLY_MODE=true`.** |
|
|
36
|
+
|
|
37
|
+
### Query and indexing tools
|
|
38
|
+
| Tool Name | Description |
|
|
39
|
+
|-----------|-------------|
|
|
40
|
+
| `list_indexes` | List all indexes in the cluster with their definitions, with optional filtering by bucket, scope, collection and index name. |
|
|
41
|
+
| `get_index_advisor_recommendations` | Get index recommendations from Couchbase Index Advisor for a given SQL++ query to optimize query performance |
|
|
42
|
+
| `run_sql_plus_plus_query` | Run a [SQL++ query](https://www.couchbase.com/sqlplusplus/) on a specified scope.<br><br>Queries are automatically scoped to the specified bucket and scope, so use collection names directly (e.g., `SELECT * FROM users` instead of `SELECT * FROM bucket.scope.users`).<br><br>`CB_MCP_READ_ONLY_MODE` is `true` by default, which means that **all write operations (KV and Query)** are disabled. When enabled, KV write tools are not loaded and SQL++ queries that modify data are blocked. |
|
|
43
|
+
|
|
44
|
+
### Query performance analysis tools
|
|
45
|
+
| Tool Name | Description |
|
|
46
|
+
|-----------|-------------|
|
|
47
|
+
| `get_longest_running_queries` | Get longest running queries by average service time |
|
|
48
|
+
| `get_most_frequent_queries` | Get most frequently executed queries |
|
|
49
|
+
| `get_queries_with_largest_response_sizes` | Get queries with the largest response sizes |
|
|
50
|
+
| `get_queries_with_large_result_count` | Get queries with the largest result counts |
|
|
51
|
+
| `get_queries_using_primary_index` | Get queries that use a primary index (potential performance concern) |
|
|
52
|
+
| `get_queries_not_using_covering_index` | Get queries that don't use a covering index |
|
|
53
|
+
| `get_queries_not_selective` | Get queries that are not selective (index scans return many more documents than final result) |
|
|
54
|
+
|
|
55
|
+
## Usage
|
|
56
|
+
|
|
57
|
+
The Docker images can be used in the supported MCP clients such as Claude Desktop, Cursor, Windsurf, etc in combination with Docker.
|
|
58
|
+
|
|
59
|
+
### Configuration
|
|
60
|
+
|
|
61
|
+
Add the configuration specified below to the MCP configuration in your MCP client.
|
|
62
|
+
|
|
63
|
+
- Claude Desktop: https://modelcontextprotocol.io/quickstart/user
|
|
64
|
+
- Cursor: https://docs.cursor.com/context/model-context-protocol#configuring-mcp-servers
|
|
65
|
+
- Windsurf: https://docs.windsurf.com/windsurf/cascade/mcp#adding-a-new-mcp-plugin
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"mcpServers": {
|
|
70
|
+
"couchbase": {
|
|
71
|
+
"command": "docker",
|
|
72
|
+
"args": [
|
|
73
|
+
"run",
|
|
74
|
+
"--rm",
|
|
75
|
+
"-i",
|
|
76
|
+
"-e",
|
|
77
|
+
"CB_CONNECTION_STRING=<couchbase_connection_string>",
|
|
78
|
+
"-e",
|
|
79
|
+
"CB_USERNAME=<database_username>",
|
|
80
|
+
"-e",
|
|
81
|
+
"CB_PASSWORD=<database_password>",
|
|
82
|
+
"couchbaseecosystem/mcp-server-couchbase:latest"
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Environment Variables
|
|
90
|
+
|
|
91
|
+
The detailed explanation for the environment variables can be found on the [Github Repo](https://github.com/Couchbase-Ecosystem/mcp-server-couchbase?tab=readme-ov-file#additional-configuration-for-mcp-server).
|
|
92
|
+
|
|
93
|
+
| Variable | Description | Default |
|
|
94
|
+
| ----------------------------- | --------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
|
|
95
|
+
| `CB_CONNECTION_STRING` | Couchbase Connection string | **Required** |
|
|
96
|
+
| `CB_USERNAME` | Database username | **Required (or Client Certificate and Key needed for mTLS)** |
|
|
97
|
+
| `CB_PASSWORD` | Database password | **Required (or Client Certificate and Key needed for mTLS)** |
|
|
98
|
+
| `CB_CLIENT_CERT_PATH` | Path to the client certificate file for mTLS authentication | **Required if using mTLS (or Username and Password required)** |
|
|
99
|
+
| `CB_CLIENT_KEY_PATH` | Path to the client key file for mTLS authentication | **Required if using mTLS (or Username and Password required)** |
|
|
100
|
+
| `CB_CA_CERT_PATH` | Path to server root certificate for TLS if server is configured with a self-signed/untrusted certificate. | |
|
|
101
|
+
| `CB_MCP_READ_ONLY_MODE` | Prevent all data modifications (KV and Query). When `true`, KV write tools are not loaded. | `true` |
|
|
102
|
+
| `CB_MCP_TRANSPORT` | Transport mode (stdio/http/sse) | `stdio` |
|
|
103
|
+
| `CB_MCP_HOST` | Server host (HTTP/SSE modes) | `127.0.0.1` |
|
|
104
|
+
| `CB_MCP_PORT` | Server port (HTTP/SSE modes) | `8000` |
|
|
105
|
+
| `CB_MCP_DISABLED_TOOLS` | Tools to disable | |
|
|
106
|
+
|
|
107
|
+
### Disabling Tools
|
|
108
|
+
|
|
109
|
+
You can disable specific tools to prevent them from being loaded and exposed to the MCP client. Disabled tools will not appear in the tool discovery and cannot be invoked by the LLM.
|
|
110
|
+
|
|
111
|
+
#### Supported Formats
|
|
112
|
+
|
|
113
|
+
**Comma-separated list:**
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Environment variable
|
|
117
|
+
CB_MCP_DISABLED_TOOLS="upsert_document_by_id, delete_document_by_id"
|
|
118
|
+
|
|
119
|
+
# Command line
|
|
120
|
+
uvx couchbase-mcp-server --disabled-tools upsert_document_by_id, delete_document_by_id
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**File path (one tool name per line):**
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Environment variable
|
|
127
|
+
CB_MCP_DISABLED_TOOLS=disabled_tools.txt
|
|
128
|
+
|
|
129
|
+
# Command line
|
|
130
|
+
uvx couchbase-mcp-server --disabled-tools disabled_tools.txt
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**File format (e.g., `disabled_tools.txt`):**
|
|
134
|
+
|
|
135
|
+
```text
|
|
136
|
+
# Write operations
|
|
137
|
+
upsert_document_by_id
|
|
138
|
+
delete_document_by_id
|
|
139
|
+
|
|
140
|
+
# Index advisor
|
|
141
|
+
get_index_advisor_recommendations
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Lines starting with `#` are treated as comments and ignored.
|
|
145
|
+
|
|
146
|
+
#### MCP Client Configuration Examples
|
|
147
|
+
|
|
148
|
+
**Using comma-separated list:**
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"mcpServers": {
|
|
153
|
+
"couchbase": {
|
|
154
|
+
"command": "uvx",
|
|
155
|
+
"args": ["couchbase-mcp-server"],
|
|
156
|
+
"env": {
|
|
157
|
+
"CB_CONNECTION_STRING": "couchbases://connection-string",
|
|
158
|
+
"CB_USERNAME": "username",
|
|
159
|
+
"CB_PASSWORD": "password",
|
|
160
|
+
"CB_MCP_DISABLED_TOOLS": "upsert_document_by_id,delete_document_by_id"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Using file path (recommended for many tools):**
|
|
168
|
+
|
|
169
|
+
```json
|
|
170
|
+
{
|
|
171
|
+
"mcpServers": {
|
|
172
|
+
"couchbase": {
|
|
173
|
+
"command": "uvx",
|
|
174
|
+
"args": ["couchbase-mcp-server"],
|
|
175
|
+
"env": {
|
|
176
|
+
"CB_CONNECTION_STRING": "couchbases://connection-string",
|
|
177
|
+
"CB_USERNAME": "username",
|
|
178
|
+
"CB_PASSWORD": "password",
|
|
179
|
+
"CB_MCP_DISABLED_TOOLS": "/path/to/disabled_tools.txt"
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
#### Important Security Note
|
|
187
|
+
|
|
188
|
+
> **Warning:** Disabling tools alone does not guarantee that certain operations cannot be performed. The underlying database user's RBAC (Role-Based Access Control) permissions are the authoritative security control.
|
|
189
|
+
>
|
|
190
|
+
> For example, even if you disable `upsert_document_by_id` and `delete_document_by_id`, data modifications can still occur via the `run_sql_plus_plus_query` tool using SQL++ DML statements (INSERT, UPDATE, DELETE, MERGE) unless:
|
|
191
|
+
> - The `CB_MCP_READ_ONLY_MODE` is set to `true` (default), which disables all write operations (KV and Query), OR
|
|
192
|
+
> - The database user lacks the necessary RBAC permissions for data modification
|
|
193
|
+
>
|
|
194
|
+
> **Best Practice:** Always configure appropriate RBAC permissions on your Couchbase user credentials as the primary security measure. Use `CB_MCP_READ_ONLY_MODE=true` (the default) for comprehensive write protection, and tool disabling as an additional layer to guide LLM behavior.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: couchbase-mcp-server
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: Couchbase MCP Server - The Developer Data Platform for Critical Applications in Our AI World
|
|
5
5
|
Project-URL: Homepage, https://github.com/Couchbase-Ecosystem/mcp-server-couchbase
|
|
6
6
|
Project-URL: Documentation, https://github.com/Couchbase-Ecosystem/mcp-server-couchbase#readme
|
|
@@ -20,6 +20,7 @@ Requires-Dist: urllib3>=2.0.0
|
|
|
20
20
|
Provides-Extra: dev
|
|
21
21
|
Requires-Dist: pre-commit==4.2.0; extra == 'dev'
|
|
22
22
|
Requires-Dist: pytest-asyncio==0.24.0; extra == 'dev'
|
|
23
|
+
Requires-Dist: pytest-cov>=7.0.0; extra == 'dev'
|
|
23
24
|
Requires-Dist: pytest==8.3.3; extra == 'dev'
|
|
24
25
|
Requires-Dist: ruff==0.12.5; extra == 'dev'
|
|
25
26
|
Description-Content-Type: text/markdown
|
|
@@ -36,32 +37,49 @@ An [MCP](https://modelcontextprotocol.io/) server implementation of Couchbase th
|
|
|
36
37
|
|
|
37
38
|
<!-- mcp-name: io.github.Couchbase-Ecosystem/mcp-server-couchbase -->
|
|
38
39
|
|
|
39
|
-
## Features
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
40
|
+
## Features/Tools
|
|
41
|
+
### Cluster setup & health tools
|
|
42
|
+
| Tool Name | Description |
|
|
43
|
+
|-----------|-------------|
|
|
44
|
+
| `get_server_configuration_status` | Get the status of the MCP server |
|
|
45
|
+
| `test_cluster_connection` | Check the cluster credentials by connecting to the cluster |
|
|
46
|
+
| `get_cluster_health_and_services` | Get cluster health status and list of all running services |
|
|
47
|
+
|
|
48
|
+
### Data model & schema discovery tools
|
|
49
|
+
| Tool Name | Description |
|
|
50
|
+
|-----------|-------------|
|
|
51
|
+
| `get_buckets_in_cluster` | Get a list of all the buckets in the cluster |
|
|
52
|
+
| `get_scopes_in_bucket` | Get a list of all the scopes in the specified bucket |
|
|
53
|
+
| `get_collections_in_scope` | Get a list of all the collections in a specified scope and bucket. Note that this tool requires the cluster to have Query service. |
|
|
54
|
+
| `get_scopes_and_collections_in_bucket` | Get a list of all the scopes and collections in the specified bucket |
|
|
55
|
+
| `get_schema_for_collection` | Get the structure for a collection |
|
|
56
|
+
|
|
57
|
+
### Document KV operations tools
|
|
58
|
+
| Tool Name | Description |
|
|
59
|
+
|-----------|-------------|
|
|
60
|
+
| `get_document_by_id` | Get a document by ID from a specified scope and collection |
|
|
61
|
+
| `upsert_document_by_id` | Upsert a document by ID to a specified scope and collection. **Disabled by default when `CB_MCP_READ_ONLY_MODE=true`.** |
|
|
62
|
+
| `insert_document_by_id` | Insert a new document by ID (fails if document exists). **Disabled by default when `CB_MCP_READ_ONLY_MODE=true`.** |
|
|
63
|
+
| `replace_document_by_id` | Replace an existing document by ID (fails if document doesn't exist). **Disabled by default when `CB_MCP_READ_ONLY_MODE=true`.** |
|
|
64
|
+
| `delete_document_by_id` | Delete a document by ID from a specified scope and collection. **Disabled by default when `CB_MCP_READ_ONLY_MODE=true`.** |
|
|
65
|
+
|
|
66
|
+
### Query and indexing tools
|
|
67
|
+
| Tool Name | Description |
|
|
68
|
+
|-----------|-------------|
|
|
69
|
+
| `list_indexes` | List all indexes in the cluster with their definitions, with optional filtering by bucket, scope, collection and index name. |
|
|
70
|
+
| `get_index_advisor_recommendations` | Get index recommendations from Couchbase Index Advisor for a given SQL++ query to optimize query performance |
|
|
71
|
+
| `run_sql_plus_plus_query` | Run a [SQL++ query](https://www.couchbase.com/sqlplusplus/) on a specified scope.<br><br>Queries are automatically scoped to the specified bucket and scope, so use collection names directly (e.g., `SELECT * FROM users` instead of `SELECT * FROM bucket.scope.users`).<br><br>`CB_MCP_READ_ONLY_MODE` is `true` by default, which means that **all write operations (KV and Query)** are disabled. When enabled, KV write tools are not loaded and SQL++ queries that modify data are blocked. |
|
|
72
|
+
|
|
73
|
+
### Query performance analysis tools
|
|
74
|
+
| Tool Name | Description |
|
|
75
|
+
|-----------|-------------|
|
|
76
|
+
| `get_longest_running_queries` | Get longest running queries by average service time |
|
|
77
|
+
| `get_most_frequent_queries` | Get most frequently executed queries |
|
|
78
|
+
| `get_queries_with_largest_response_sizes` | Get queries with the largest response sizes |
|
|
79
|
+
| `get_queries_with_large_result_count` | Get queries with the largest result counts |
|
|
80
|
+
| `get_queries_using_primary_index` | Get queries that use a primary index (potential performance concern) |
|
|
81
|
+
| `get_queries_not_using_covering_index` | Get queries that don't use a covering index |
|
|
82
|
+
| `get_queries_not_selective` | Get queries that are not selective (index scans return many more documents than final result) |
|
|
65
83
|
|
|
66
84
|
## Prerequisites
|
|
67
85
|
|
|
@@ -170,21 +188,135 @@ The server can be configured using environment variables or command line argumen
|
|
|
170
188
|
| `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)** |
|
|
171
189
|
| `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)** |
|
|
172
190
|
| `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 | |
|
|
173
|
-
| `
|
|
191
|
+
| `CB_MCP_READ_ONLY_MODE` | `--read-only-mode` | Prevent all data modifications (KV and Query). When enabled, KV write tools are not loaded. | `true` |
|
|
192
|
+
| `CB_MCP_READ_ONLY_QUERY_MODE` | `--read-only-query-mode` | **[DEPRECATED]** Prevent queries that modify data. Note that data modification would still be possible via document operations tools. Use `CB_MCP_READ_ONLY_MODE` instead. | `true` |
|
|
174
193
|
| `CB_MCP_TRANSPORT` | `--transport` | Transport mode: `stdio`, `http`, `sse` | `stdio` |
|
|
175
194
|
| `CB_MCP_HOST` | `--host` | Host for HTTP/SSE transport modes | `127.0.0.1` |
|
|
176
195
|
| `CB_MCP_PORT` | `--port` | Port for HTTP/SSE transport modes | `8000` |
|
|
196
|
+
| `CB_MCP_DISABLED_TOOLS` | `--disabled-tools` | Tools to disable (see [Disabling Tools](#disabling-tools)) | None |
|
|
197
|
+
|
|
198
|
+
#### Read-Only Mode Configuration
|
|
199
|
+
|
|
200
|
+
The MCP server provides two configuration options for controlling write operations:
|
|
201
|
+
|
|
202
|
+
**`CB_MCP_READ_ONLY_MODE`** (Recommended)
|
|
203
|
+
- When `true` (default): All write operations are disabled. KV write tools (upsert, insert, replace, delete) are **not loaded** and will not be available to the LLM.
|
|
204
|
+
- When `false`: KV write tools are loaded and available.
|
|
205
|
+
|
|
206
|
+
**`CB_MCP_READ_ONLY_QUERY_MODE`** (Deprecated)
|
|
207
|
+
- This option only controls SQL++ query-based writes but does not prevent KV write operations.
|
|
208
|
+
- **Deprecated**: Use `CB_MCP_READ_ONLY_MODE` instead for comprehensive protection.
|
|
209
|
+
|
|
210
|
+
**Mode Behavior Truth Table:**
|
|
211
|
+
|
|
212
|
+
| `READ_ONLY_MODE` | `READ_ONLY_QUERY_MODE` | Result |
|
|
213
|
+
|------------------|------------------------|--------|
|
|
214
|
+
| `true` | `true` | Read-only KV and Query operations. All writes disabled. |
|
|
215
|
+
| `true` | `false` | Read-only KV and Query operations. All writes disabled. |
|
|
216
|
+
| `false` | `true` | Only Query writes disabled. KV writes allowed. |
|
|
217
|
+
| `false` | `false` | All KV and Query operations allowed. |
|
|
218
|
+
|
|
219
|
+
> **Important**: When `READ_ONLY_MODE` is `true`, it takes precedence and disables all write operations regardless of `READ_ONLY_QUERY_MODE` setting. This is the recommended safe default to prevent inadvertent data modifications by LLMs.
|
|
177
220
|
|
|
178
221
|
> 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.
|
|
179
222
|
> If both the Client Certificate & key path and the username and password are specified, the client certificates will be used for authentication.
|
|
180
223
|
|
|
224
|
+
### Disabling Tools
|
|
225
|
+
|
|
226
|
+
You can disable specific tools to prevent them from being loaded and exposed to the MCP client. Disabled tools will not appear in the tool discovery and cannot be invoked by the LLM.
|
|
227
|
+
|
|
228
|
+
#### Supported Formats
|
|
229
|
+
|
|
230
|
+
**Comma-separated list:**
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
# Environment variable
|
|
234
|
+
CB_MCP_DISABLED_TOOLS="upsert_document_by_id, delete_document_by_id"
|
|
235
|
+
|
|
236
|
+
# Command line
|
|
237
|
+
uvx couchbase-mcp-server --disabled-tools upsert_document_by_id, delete_document_by_id
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**File path (one tool name per line):**
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# Environment variable
|
|
244
|
+
CB_MCP_DISABLED_TOOLS=disabled_tools.txt
|
|
245
|
+
|
|
246
|
+
# Command line
|
|
247
|
+
uvx couchbase-mcp-server --disabled-tools disabled_tools.txt
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
**File format (e.g., `disabled_tools.txt`):**
|
|
251
|
+
|
|
252
|
+
```text
|
|
253
|
+
# Write operations
|
|
254
|
+
upsert_document_by_id
|
|
255
|
+
delete_document_by_id
|
|
256
|
+
|
|
257
|
+
# Index advisor
|
|
258
|
+
get_index_advisor_recommendations
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Lines starting with `#` are treated as comments and ignored.
|
|
262
|
+
|
|
263
|
+
#### MCP Client Configuration Examples
|
|
264
|
+
|
|
265
|
+
**Using comma-separated list:**
|
|
266
|
+
|
|
267
|
+
```json
|
|
268
|
+
{
|
|
269
|
+
"mcpServers": {
|
|
270
|
+
"couchbase": {
|
|
271
|
+
"command": "uvx",
|
|
272
|
+
"args": ["couchbase-mcp-server"],
|
|
273
|
+
"env": {
|
|
274
|
+
"CB_CONNECTION_STRING": "couchbases://connection-string",
|
|
275
|
+
"CB_USERNAME": "username",
|
|
276
|
+
"CB_PASSWORD": "password",
|
|
277
|
+
"CB_MCP_DISABLED_TOOLS": "upsert_document_by_id,delete_document_by_id"
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
**Using file path (recommended for many tools):**
|
|
285
|
+
|
|
286
|
+
```json
|
|
287
|
+
{
|
|
288
|
+
"mcpServers": {
|
|
289
|
+
"couchbase": {
|
|
290
|
+
"command": "uvx",
|
|
291
|
+
"args": ["couchbase-mcp-server"],
|
|
292
|
+
"env": {
|
|
293
|
+
"CB_CONNECTION_STRING": "couchbases://connection-string",
|
|
294
|
+
"CB_USERNAME": "username",
|
|
295
|
+
"CB_PASSWORD": "password",
|
|
296
|
+
"CB_MCP_DISABLED_TOOLS": "/path/to/disabled_tools.txt"
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
#### Important Security Note
|
|
304
|
+
|
|
305
|
+
> **Warning:** Disabling tools alone does not guarantee that certain operations cannot be performed. The underlying database user's RBAC (Role-Based Access Control) permissions are the authoritative security control.
|
|
306
|
+
>
|
|
307
|
+
> For example, even if you disable `upsert_document_by_id` and `delete_document_by_id`, data modifications can still occur via the `run_sql_plus_plus_query` tool using SQL++ DML statements (INSERT, UPDATE, DELETE, MERGE) unless:
|
|
308
|
+
> - The `CB_MCP_READ_ONLY_MODE` is set to `true` (default), OR
|
|
309
|
+
> - The database user lacks the necessary RBAC permissions for data modification
|
|
310
|
+
>
|
|
311
|
+
> **Best Practice:** Always configure appropriate RBAC permissions on your Couchbase user credentials as the primary security measure. Use tool disabling as an additional layer to guide LLM behavior and reduce the attack surface, not as the sole security control.
|
|
312
|
+
|
|
181
313
|
You can also check the version of the server using:
|
|
182
314
|
|
|
183
315
|
```bash
|
|
184
316
|
uvx couchbase-mcp-server --version
|
|
185
317
|
```
|
|
186
318
|
|
|
187
|
-
|
|
319
|
+
### Client Specific Configuration
|
|
188
320
|
|
|
189
321
|
<details>
|
|
190
322
|
<summary>Claude Desktop</summary>
|
|
@@ -259,6 +391,60 @@ For more details about MCP integration with Windsurf Editor, refer to the offici
|
|
|
259
391
|
|
|
260
392
|
</details>
|
|
261
393
|
|
|
394
|
+
<details>
|
|
395
|
+
<summary>VS Code</summary>
|
|
396
|
+
|
|
397
|
+
Follow the steps below to use the Couchbase MCP server with [VS Code](https://code.visualstudio.com/).
|
|
398
|
+
1. Install [VS Code](https://code.visualstudio.com/)
|
|
399
|
+
2. Following are a couple of ways to configure the MCP server.
|
|
400
|
+
* For a Workspace server configuration
|
|
401
|
+
- Create a new file in workspace as .vscode/mcp.json.
|
|
402
|
+
- Add the [configuration](#configuration) and save the file.
|
|
403
|
+
* For the Global server configuration:
|
|
404
|
+
- Run **MCP: Open User Configuration** in the Command Pallete(`Ctrl+Shift+P` or `Cmd+Shift+P`)
|
|
405
|
+
- Add the [configuration](#configuration) and save the file.
|
|
406
|
+
* **Note**: VS Code uses `servers` as the top-level JSON property in mcp.json files to define MCP (Model Context Protocol) servers, while Cursor uses `mcpServers` for the equivalent configuration. Check the [VS Code client configurations](https://code.visualstudio.com/docs/copilot/customization/mcp-servers) for any further changes or details. An example VS Code configuration is provided below.
|
|
407
|
+
```json
|
|
408
|
+
{
|
|
409
|
+
"servers": {
|
|
410
|
+
"couchbase": {
|
|
411
|
+
"command": "uvx",
|
|
412
|
+
"args": ["couchbase-mcp-server"],
|
|
413
|
+
"env": {
|
|
414
|
+
"CB_CONNECTION_STRING": "couchbases://connection-string",
|
|
415
|
+
"CB_USERNAME": "username",
|
|
416
|
+
"CB_PASSWORD": "password"
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
```
|
|
422
|
+
3. Once you save the file, the server starts and a small action list appears with `Running|Stop|n Tools|More..`.
|
|
423
|
+
4. Click on the options from the option list to `Start`/`Stop`/manage the server.
|
|
424
|
+
5. You can now use the Couchbase MCP server in VS Code to query your Couchbase cluster using natural language and perform CRUD operations on documents.
|
|
425
|
+
|
|
426
|
+
Logs:
|
|
427
|
+
In the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P`),
|
|
428
|
+
- run **MCP: List Servers** command and pick the couchbase server
|
|
429
|
+
- choose “Show Output” to see its logs in the Output tab.
|
|
430
|
+
</details>
|
|
431
|
+
|
|
432
|
+
<details>
|
|
433
|
+
<summary>JetBrains IDEs</summary>
|
|
434
|
+
|
|
435
|
+
Follow the steps below to use the Couchbase MCP server with [JetBrains IDEs](https://www.jetbrains.com/)
|
|
436
|
+
1. Install any one of the [JetBrains IDEs](https://www.jetbrains.com/)
|
|
437
|
+
2. Install any one of the JetBrains plugins - [AI Assistant](https://www.jetbrains.com/help/ai-assistant/getting-started-with-ai-assistant.html) or [Junie](https://www.jetbrains.com/help/junie/get-started-with-junie.html)
|
|
438
|
+
3. Navigate to **Settings > Tools > AI Assistant or Junie > MCP Server**
|
|
439
|
+
4. Click "+" to add the Couchbase MCP [configuration](#configuration) and click Save.
|
|
440
|
+
5. You will see the Couchbase MCP server added to the list of servers. Once you click Apply, the Couchbase MCP server starts and on-hover of status, it shows all the tools available.
|
|
441
|
+
6. You can now use the Couchbase MCP server in JetBrains IDEs to query your Couchbase cluster using natural language and perform CRUD operations on documents.
|
|
442
|
+
|
|
443
|
+
Logs:
|
|
444
|
+
The log file can be explored at **Help > Show Log in Finder (Explorer) > mcp > couchbase**
|
|
445
|
+
|
|
446
|
+
</details>
|
|
447
|
+
|
|
262
448
|
## Streamable HTTP Transport Mode
|
|
263
449
|
|
|
264
450
|
The MCP Server can be run in [Streamable HTTP](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#streamable-http) transport mode which allows multiple clients to connect to the same server instance via HTTP.
|
|
@@ -275,7 +461,7 @@ uvx couchbase-mcp-server \
|
|
|
275
461
|
--connection-string='<couchbase_connection_string>' \
|
|
276
462
|
--username='<database_username>' \
|
|
277
463
|
--password='<database_password>' \
|
|
278
|
-
--read-only-
|
|
464
|
+
--read-only-mode=true \
|
|
279
465
|
--transport=http
|
|
280
466
|
```
|
|
281
467
|
|
|
@@ -308,7 +494,7 @@ uvx couchbase-mcp-server \
|
|
|
308
494
|
--connection-string='<couchbase_connection_string>' \
|
|
309
495
|
--username='<database_username>' \
|
|
310
496
|
--password='<database_password>' \
|
|
311
|
-
--read-only-
|
|
497
|
+
--read-only-mode=true \
|
|
312
498
|
--transport=sse
|
|
313
499
|
```
|
|
314
500
|
|