couchbase-mcp-server 0.5.2rc6__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.6.0/.github/workflows/test.yml +297 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/.github/workflows/update-mcp-registry.yml +5 -3
- couchbase_mcp_server-0.6.0/DOCKER.md +194 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/PKG-INFO +234 -22
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/README.md +230 -21
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/pyproject.toml +9 -1
- couchbase_mcp_server-0.6.0/scripts/setup_test_data.py +458 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/server.json +3 -3
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/src/mcp_server.py +54 -6
- couchbase_mcp_server-0.6.0/src/tools/__init__.py +135 -0
- couchbase_mcp_server-0.6.0/src/tools/kv.py +143 -0
- couchbase_mcp_server-0.6.0/src/tools/query.py +365 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/src/tools/server.py +1 -0
- {couchbase_mcp_server-0.5.2rc6 → 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.2rc6 → couchbase_mcp_server-0.6.0}/src/utils/context.py +11 -1
- couchbase_mcp_server-0.6.0/tests/conftest.py +255 -0
- couchbase_mcp_server-0.6.0/tests/test_disabled_tools.py +264 -0
- couchbase_mcp_server-0.6.0/tests/test_index_tools.py +209 -0
- couchbase_mcp_server-0.6.0/tests/test_kv_tools.py +481 -0
- couchbase_mcp_server-0.6.0/tests/test_mcp_integration.py +262 -0
- couchbase_mcp_server-0.6.0/tests/test_performance_tools.py +291 -0
- couchbase_mcp_server-0.6.0/tests/test_query_tools.py +156 -0
- couchbase_mcp_server-0.6.0/tests/test_read_only_mode.py +275 -0
- couchbase_mcp_server-0.6.0/tests/test_server_tools.py +137 -0
- couchbase_mcp_server-0.6.0/tests/test_utils.py +556 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/uv.lock +188 -1
- couchbase_mcp_server-0.5.2rc6/DOCKER.md +0 -78
- couchbase_mcp_server-0.5.2rc6/src/tools/__init__.py +0 -70
- couchbase_mcp_server-0.5.2rc6/src/tools/kv.py +0 -80
- couchbase_mcp_server-0.5.2rc6/src/tools/query.py +0 -98
- couchbase_mcp_server-0.5.2rc6/src/utils/config.py +0 -13
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/.github/workflows/alert-on-pr.yml +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/.github/workflows/docker.yml +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/.github/workflows/release.yml +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/.github/workflows/test_release.yml +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/.gitignore +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/.pre-commit-config.yaml +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/CONTRIBUTING.md +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/Dockerfile +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/LICENSE +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/RELEASE.md +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/build.sh +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/glama.json +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/scripts/lint.sh +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/scripts/lint_fix.sh +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/scripts/update_version.sh +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/smithery.yaml +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/src/certs/__init__.py +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/src/certs/capella_root_ca.pem +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/src/tools/index.py +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/src/utils/connection.py +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/src/utils/constants.py +0 -0
- {couchbase_mcp_server-0.5.2rc6 → couchbase_mcp_server-0.6.0}/src/utils/index_utils.py +0 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
permissions:
|
|
4
|
+
contents: read
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [main]
|
|
11
|
+
|
|
12
|
+
env:
|
|
13
|
+
# Default test credentials for Couchbase
|
|
14
|
+
CB_USERNAME: Administrator
|
|
15
|
+
CB_PASSWORD: password
|
|
16
|
+
CB_MCP_TEST_BUCKET: travel-sample
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
# ============================================
|
|
20
|
+
# Integration Tests - All Transport Modes
|
|
21
|
+
# ============================================
|
|
22
|
+
integration-tests:
|
|
23
|
+
name: Integration (${{ matrix.transport }} transport)
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
strategy:
|
|
26
|
+
fail-fast: false
|
|
27
|
+
matrix:
|
|
28
|
+
transport: ["stdio", "http", "sse"]
|
|
29
|
+
|
|
30
|
+
services:
|
|
31
|
+
couchbase:
|
|
32
|
+
image: couchbase:enterprise-8.0.0
|
|
33
|
+
ports:
|
|
34
|
+
- 8091:8091
|
|
35
|
+
- 8092:8092
|
|
36
|
+
- 8093:8093
|
|
37
|
+
- 8094:8094
|
|
38
|
+
- 8095:8095
|
|
39
|
+
- 8096:8096
|
|
40
|
+
- 9102:9102
|
|
41
|
+
- 11210:11210
|
|
42
|
+
- 11207:11207
|
|
43
|
+
options: >-
|
|
44
|
+
--health-cmd "curl -s http://localhost:8091/pools || exit 1"
|
|
45
|
+
--health-interval 10s
|
|
46
|
+
--health-timeout 5s
|
|
47
|
+
--health-retries 30
|
|
48
|
+
|
|
49
|
+
steps:
|
|
50
|
+
- name: Checkout code
|
|
51
|
+
uses: actions/checkout@v4
|
|
52
|
+
|
|
53
|
+
- name: Install uv
|
|
54
|
+
uses: astral-sh/setup-uv@v4
|
|
55
|
+
with:
|
|
56
|
+
version: "latest"
|
|
57
|
+
|
|
58
|
+
- name: Set up Python (latest)
|
|
59
|
+
run: uv python install 3.13
|
|
60
|
+
|
|
61
|
+
- name: Install dependencies
|
|
62
|
+
run: uv sync --extra dev
|
|
63
|
+
|
|
64
|
+
- name: Wait for Couchbase to be ready
|
|
65
|
+
run: |
|
|
66
|
+
echo "Waiting for Couchbase to be fully ready..."
|
|
67
|
+
for i in {1..60}; do
|
|
68
|
+
if curl -s http://localhost:8091/pools > /dev/null 2>&1; then
|
|
69
|
+
echo "Couchbase REST API is responding"
|
|
70
|
+
break
|
|
71
|
+
fi
|
|
72
|
+
echo "Waiting for Couchbase... ($i/60)"
|
|
73
|
+
sleep 2
|
|
74
|
+
done
|
|
75
|
+
|
|
76
|
+
- name: Initialize Couchbase cluster
|
|
77
|
+
run: |
|
|
78
|
+
echo "Initializing Couchbase cluster..."
|
|
79
|
+
|
|
80
|
+
# Initialize node
|
|
81
|
+
curl -s -X POST http://localhost:8091/nodes/self/controller/settings \
|
|
82
|
+
-d 'path=/opt/couchbase/var/lib/couchbase/data' \
|
|
83
|
+
-d 'index_path=/opt/couchbase/var/lib/couchbase/data'
|
|
84
|
+
|
|
85
|
+
# Set up services
|
|
86
|
+
curl -s -X POST http://localhost:8091/node/controller/setupServices \
|
|
87
|
+
-d 'services=kv,n1ql,index,fts'
|
|
88
|
+
|
|
89
|
+
# Set memory quotas
|
|
90
|
+
curl -s -X POST http://localhost:8091/pools/default \
|
|
91
|
+
-d 'memoryQuota=512' \
|
|
92
|
+
-d 'indexMemoryQuota=256' \
|
|
93
|
+
-d 'ftsMemoryQuota=256'
|
|
94
|
+
|
|
95
|
+
# Set credentials
|
|
96
|
+
curl -s -X POST http://localhost:8091/settings/web \
|
|
97
|
+
-d "password=${{ env.CB_PASSWORD }}" \
|
|
98
|
+
-d "username=${{ env.CB_USERNAME }}" \
|
|
99
|
+
-d 'port=SAME'
|
|
100
|
+
|
|
101
|
+
echo "Cluster initialization complete"
|
|
102
|
+
|
|
103
|
+
- name: Load travel-sample bucket
|
|
104
|
+
run: |
|
|
105
|
+
echo "Loading travel-sample bucket..."
|
|
106
|
+
|
|
107
|
+
# Wait for cluster to be fully initialized
|
|
108
|
+
sleep 5
|
|
109
|
+
|
|
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
|
+
-u "${{ env.CB_USERNAME }}:${{ env.CB_PASSWORD }}" \
|
|
113
|
+
-H "Content-Type: application/json" \
|
|
114
|
+
-d '["travel-sample"]'
|
|
115
|
+
|
|
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
|
|
119
|
+
if curl -s -u "${{ env.CB_USERNAME }}:${{ env.CB_PASSWORD }}" \
|
|
120
|
+
http://localhost:8091/pools/default/buckets/travel-sample 2>/dev/null | grep -q '"status":"healthy"'; then
|
|
121
|
+
echo "Bucket is healthy"
|
|
122
|
+
break
|
|
123
|
+
fi
|
|
124
|
+
echo "Waiting for bucket... ($i/60)"
|
|
125
|
+
sleep 3
|
|
126
|
+
done
|
|
127
|
+
|
|
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
|
|
133
|
+
run: |
|
|
134
|
+
echo "Setting indexer storage mode..."
|
|
135
|
+
# Wait for indexer service to be ready
|
|
136
|
+
sleep 5
|
|
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 \
|
|
140
|
+
-u "${{ env.CB_USERNAME }}:${{ env.CB_PASSWORD }}" \
|
|
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
|
|
146
|
+
|
|
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
|
|
154
|
+
run: |
|
|
155
|
+
echo "Running setup_test_data.py to create indexes and populate test data..."
|
|
156
|
+
uv run python scripts/setup_test_data.py
|
|
157
|
+
|
|
158
|
+
# ============================================
|
|
159
|
+
# STDIO Transport Tests
|
|
160
|
+
# ============================================
|
|
161
|
+
- name: Run STDIO integration tests
|
|
162
|
+
if: matrix.transport == 'stdio'
|
|
163
|
+
env:
|
|
164
|
+
CB_CONNECTION_STRING: couchbase://localhost
|
|
165
|
+
CB_MCP_TRANSPORT: stdio
|
|
166
|
+
CB_MCP_TEST_SCOPE: inventory
|
|
167
|
+
CB_MCP_TEST_COLLECTION: airline
|
|
168
|
+
PYTHONPATH: src
|
|
169
|
+
run: |
|
|
170
|
+
echo "Running tests with STDIO transport..."
|
|
171
|
+
uv run pytest tests/ -v --tb=short
|
|
172
|
+
|
|
173
|
+
# ============================================
|
|
174
|
+
# HTTP Transport Tests
|
|
175
|
+
# ============================================
|
|
176
|
+
- name: Start MCP server (HTTP)
|
|
177
|
+
if: matrix.transport == 'http'
|
|
178
|
+
env:
|
|
179
|
+
CB_CONNECTION_STRING: couchbase://localhost
|
|
180
|
+
CB_MCP_TRANSPORT: http
|
|
181
|
+
CB_MCP_HOST: 127.0.0.1
|
|
182
|
+
CB_MCP_PORT: 8000
|
|
183
|
+
PYTHONPATH: src
|
|
184
|
+
run: |
|
|
185
|
+
echo "Starting MCP server with HTTP transport..."
|
|
186
|
+
uv run python -m mcp_server &
|
|
187
|
+
SERVER_PID=$!
|
|
188
|
+
echo "SERVER_PID=$SERVER_PID" >> $GITHUB_ENV
|
|
189
|
+
|
|
190
|
+
# Wait for server to be ready (check if port is listening)
|
|
191
|
+
echo "Waiting for HTTP server to be ready..."
|
|
192
|
+
for i in {1..30}; do
|
|
193
|
+
if nc -z 127.0.0.1 8000 2>/dev/null; then
|
|
194
|
+
echo "HTTP server is ready"
|
|
195
|
+
break
|
|
196
|
+
fi
|
|
197
|
+
echo "Waiting for HTTP server... ($i/30)"
|
|
198
|
+
sleep 1
|
|
199
|
+
done
|
|
200
|
+
|
|
201
|
+
- name: Run HTTP transport tests
|
|
202
|
+
if: matrix.transport == 'http'
|
|
203
|
+
env:
|
|
204
|
+
CB_CONNECTION_STRING: couchbase://localhost
|
|
205
|
+
CB_MCP_TRANSPORT: http
|
|
206
|
+
CB_MCP_HOST: 127.0.0.1
|
|
207
|
+
CB_MCP_PORT: 8000
|
|
208
|
+
MCP_SERVER_URL: http://127.0.0.1:8000/mcp
|
|
209
|
+
CB_MCP_TEST_SCOPE: inventory
|
|
210
|
+
CB_MCP_TEST_COLLECTION: airline
|
|
211
|
+
PYTHONPATH: src
|
|
212
|
+
run: |
|
|
213
|
+
echo "Running tests with HTTP transport..."
|
|
214
|
+
uv run pytest tests/ -v --tb=short
|
|
215
|
+
|
|
216
|
+
- name: Stop HTTP server
|
|
217
|
+
if: matrix.transport == 'http' && always()
|
|
218
|
+
run: |
|
|
219
|
+
if [ -n "$SERVER_PID" ]; then
|
|
220
|
+
kill $SERVER_PID 2>/dev/null || true
|
|
221
|
+
fi
|
|
222
|
+
|
|
223
|
+
# ============================================
|
|
224
|
+
# SSE Transport Tests
|
|
225
|
+
# ============================================
|
|
226
|
+
- name: Start MCP server (SSE)
|
|
227
|
+
if: matrix.transport == 'sse'
|
|
228
|
+
env:
|
|
229
|
+
CB_CONNECTION_STRING: couchbase://localhost
|
|
230
|
+
CB_MCP_TRANSPORT: sse
|
|
231
|
+
CB_MCP_HOST: 127.0.0.1
|
|
232
|
+
CB_MCP_PORT: 8000
|
|
233
|
+
PYTHONPATH: src
|
|
234
|
+
run: |
|
|
235
|
+
echo "Starting MCP server with SSE transport..."
|
|
236
|
+
uv run python -m mcp_server &
|
|
237
|
+
SERVER_PID=$!
|
|
238
|
+
echo "SERVER_PID=$SERVER_PID" >> $GITHUB_ENV
|
|
239
|
+
|
|
240
|
+
# Wait for server to be ready (check if port is listening)
|
|
241
|
+
echo "Waiting for SSE server to be ready..."
|
|
242
|
+
for i in {1..30}; do
|
|
243
|
+
if nc -z 127.0.0.1 8000 2>/dev/null; then
|
|
244
|
+
echo "SSE server is ready"
|
|
245
|
+
break
|
|
246
|
+
fi
|
|
247
|
+
echo "Waiting for SSE server... ($i/30)"
|
|
248
|
+
sleep 1
|
|
249
|
+
done
|
|
250
|
+
|
|
251
|
+
- name: Run SSE transport tests
|
|
252
|
+
if: matrix.transport == 'sse'
|
|
253
|
+
env:
|
|
254
|
+
CB_CONNECTION_STRING: couchbase://localhost
|
|
255
|
+
CB_MCP_TRANSPORT: sse
|
|
256
|
+
CB_MCP_HOST: 127.0.0.1
|
|
257
|
+
CB_MCP_PORT: 8000
|
|
258
|
+
MCP_SERVER_URL: http://127.0.0.1:8000/sse
|
|
259
|
+
CB_MCP_TEST_SCOPE: inventory
|
|
260
|
+
CB_MCP_TEST_COLLECTION: airline
|
|
261
|
+
PYTHONPATH: src
|
|
262
|
+
run: |
|
|
263
|
+
echo "Running tests with SSE transport..."
|
|
264
|
+
uv run pytest tests/ -v --tb=short
|
|
265
|
+
|
|
266
|
+
- name: Stop SSE server
|
|
267
|
+
if: matrix.transport == 'sse' && always()
|
|
268
|
+
run: |
|
|
269
|
+
if [ -n "$SERVER_PID" ]; then
|
|
270
|
+
kill $SERVER_PID 2>/dev/null || true
|
|
271
|
+
fi
|
|
272
|
+
|
|
273
|
+
# ============================================
|
|
274
|
+
# Test Summary
|
|
275
|
+
# ============================================
|
|
276
|
+
test-summary:
|
|
277
|
+
name: Test Summary
|
|
278
|
+
permissions: {}
|
|
279
|
+
runs-on: ubuntu-latest
|
|
280
|
+
needs: [integration-tests]
|
|
281
|
+
if: always()
|
|
282
|
+
steps:
|
|
283
|
+
- name: Check test results
|
|
284
|
+
run: |
|
|
285
|
+
echo "=== Test Results Summary ==="
|
|
286
|
+
echo "Integration Tests: ${{ needs.integration-tests.result }}"
|
|
287
|
+
echo ""
|
|
288
|
+
|
|
289
|
+
if [ "${{ needs.integration-tests.result }}" == "failure" ]; then
|
|
290
|
+
echo "❌ Some tests failed"
|
|
291
|
+
exit 1
|
|
292
|
+
elif [ "${{ needs.integration-tests.result }}" == "cancelled" ]; then
|
|
293
|
+
echo "⚠️ Tests were cancelled"
|
|
294
|
+
exit 1
|
|
295
|
+
else
|
|
296
|
+
echo "✅ All tests passed!"
|
|
297
|
+
fi
|
|
@@ -141,7 +141,9 @@ jobs:
|
|
|
141
141
|
|
|
142
142
|
- name: Notify completion
|
|
143
143
|
if: success()
|
|
144
|
+
env:
|
|
145
|
+
VERSION: ${{ steps.version.outputs.version }}
|
|
144
146
|
run: |
|
|
145
|
-
echo "MCP Registry updated successfully for version $
|
|
146
|
-
echo "Docker image: docker.io/couchbaseecosystem/mcp-server-couchbase:$
|
|
147
|
-
echo "PyPI package: couchbase-mcp-server==$
|
|
147
|
+
echo "MCP Registry updated successfully for version $VERSION"
|
|
148
|
+
echo "Docker image: docker.io/couchbaseecosystem/mcp-server-couchbase:$VERSION"
|
|
149
|
+
echo "PyPI package: couchbase-mcp-server==$VERSION"
|
|
@@ -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.
|