couchbase-mcp-server 0.3.1rc2__py3-none-any.whl → 0.4.0rc1__py3-none-any.whl
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.4.0rc1.dist-info/METADATA +443 -0
- couchbase_mcp_server-0.4.0rc1.dist-info/RECORD +16 -0
- couchbase_mcp_server-0.4.0rc1.dist-info/entry_points.txt +2 -0
- mcp_server.py +49 -7
- tools/__init__.py +3 -3
- tools/query.py +7 -3
- tools/server.py +4 -3
- utils/__init__.py +10 -0
- utils/constants.py +10 -0
- couchbase_mcp_server-0.3.1rc2.dist-info/METADATA +0 -256
- couchbase_mcp_server-0.3.1rc2.dist-info/RECORD +0 -16
- couchbase_mcp_server-0.3.1rc2.dist-info/entry_points.txt +0 -2
- {couchbase_mcp_server-0.3.1rc2.dist-info → couchbase_mcp_server-0.4.0rc1.dist-info}/WHEEL +0 -0
- {couchbase_mcp_server-0.3.1rc2.dist-info → couchbase_mcp_server-0.4.0rc1.dist-info}/licenses/LICENSE +0 -0
- {couchbase_mcp_server-0.3.1rc2.dist-info → couchbase_mcp_server-0.4.0rc1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: couchbase-mcp-server
|
|
3
|
+
Version: 0.4.0rc1
|
|
4
|
+
Summary: Couchbase MCP Server - The Developer Data Platform for Critical Applications in Our AI World
|
|
5
|
+
Author-email: Nithish Raghunandanan <devadvocates@couchbase.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/Couchbase-Ecosystem/mcp-server-couchbase
|
|
8
|
+
Project-URL: Documentation, https://github.com/Couchbase-Ecosystem/mcp-server-couchbase#readme
|
|
9
|
+
Project-URL: Issues, https://github.com/Couchbase-Ecosystem/mcp-server-couchbase/issues
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: Database
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: click==8.2.1
|
|
17
|
+
Requires-Dist: couchbase==4.4.0
|
|
18
|
+
Requires-Dist: lark-sqlpp==0.0.1
|
|
19
|
+
Requires-Dist: mcp[cli]==1.12.0
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: ruff==0.12.5; extra == "dev"
|
|
22
|
+
Requires-Dist: pre-commit==4.2.0; extra == "dev"
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# Couchbase MCP Server
|
|
26
|
+
|
|
27
|
+
An [MCP](https://modelcontextprotocol.io/) server implementation of Couchbase that allows LLMs to directly interact with Couchbase clusters.
|
|
28
|
+
|
|
29
|
+
[](https://opensource.org/licenses/Apache-2.0) [](https://www.python.org/downloads/) [](https://pypi.org/project/couchbase-mcp-server/) [](https://mseep.ai/app/13fce476-0e74-4b1e-ab82-1df2a3204809)
|
|
30
|
+
|
|
31
|
+
<a href="https://glama.ai/mcp/servers/@Couchbase-Ecosystem/mcp-server-couchbase">
|
|
32
|
+
<img width="380" height="200" src="https://glama.ai/mcp/servers/@Couchbase-Ecosystem/mcp-server-couchbase/badge" alt="Couchbase Server MCP server" />
|
|
33
|
+
</a>
|
|
34
|
+
|
|
35
|
+
## Features
|
|
36
|
+
|
|
37
|
+
- Get a list of all the scopes and collections in the specified bucket
|
|
38
|
+
- Get the structure for a collection
|
|
39
|
+
- Get a document by ID from a specified scope and collection
|
|
40
|
+
- Upsert a document by ID to a specified scope and collection
|
|
41
|
+
- Delete a document by ID from a specified scope and collection
|
|
42
|
+
- Run a [SQL++ query](https://www.couchbase.com/sqlplusplus/) on a specified scope
|
|
43
|
+
- 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.
|
|
44
|
+
- Get the status of the MCP server
|
|
45
|
+
- Check the cluster credentials by connecting to the cluster
|
|
46
|
+
|
|
47
|
+
## Prerequisites
|
|
48
|
+
|
|
49
|
+
- Python 3.10 or higher.
|
|
50
|
+
- A running Couchbase cluster. The easiest way to get started is to use [Capella](https://docs.couchbase.com/cloud/get-started/create-account.html#getting-started) free tier, which is fully managed version of Couchbase server. You can follow [instructions](https://docs.couchbase.com/cloud/clusters/data-service/import-data-documents.html#import-sample-data) to import one of the sample datasets or import your own.
|
|
51
|
+
- [uv](https://docs.astral.sh/uv/) installed to run the server.
|
|
52
|
+
- An [MCP client](https://modelcontextprotocol.io/clients) such as [Claude Desktop](https://claude.ai/download) installed to connect the server to Claude. The instructions are provided for Claude Desktop and Cursor. Other MCP clients could be used as well.
|
|
53
|
+
|
|
54
|
+
## Configuration
|
|
55
|
+
|
|
56
|
+
The MCP server can be run either from the pre built PyPI package or the source using uv.
|
|
57
|
+
|
|
58
|
+
### Running from PyPI
|
|
59
|
+
|
|
60
|
+
We publish a pre built [PyPI package](https://pypi.org/project/couchbase-mcp-server/) for the MCP server.
|
|
61
|
+
|
|
62
|
+
#### Server Configuration using Pre built Package for MCP Clients
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"mcpServers": {
|
|
67
|
+
"couchbase": {
|
|
68
|
+
"command": "uvx",
|
|
69
|
+
"args": ["couchbase-mcp-server"],
|
|
70
|
+
"env": {
|
|
71
|
+
"CB_CONNECTION_STRING": "couchbases://connection-string",
|
|
72
|
+
"CB_USERNAME": "username",
|
|
73
|
+
"CB_PASSWORD": "password",
|
|
74
|
+
"CB_BUCKET_NAME": "bucket_name"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
> Note: If you have other MCP servers in use in the client, you can add it to the existing `mcpServers` object.
|
|
82
|
+
|
|
83
|
+
### Running from Source
|
|
84
|
+
|
|
85
|
+
The MCP server can be run from the source using this repository.
|
|
86
|
+
|
|
87
|
+
#### Clone the repository to your local machine.
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
git clone https://github.com/Couchbase-Ecosystem/mcp-server-couchbase.git
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
#### Server Configuration using Source for MCP Clients
|
|
94
|
+
|
|
95
|
+
This is the common configuration for the MCP clients such as Claude Desktop, Cursor, Windsurf Editor.
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"mcpServers": {
|
|
100
|
+
"couchbase": {
|
|
101
|
+
"command": "uv",
|
|
102
|
+
"args": [
|
|
103
|
+
"--directory",
|
|
104
|
+
"path/to/cloned/repo/mcp-server-couchbase/",
|
|
105
|
+
"run",
|
|
106
|
+
"src/mcp_server.py"
|
|
107
|
+
],
|
|
108
|
+
"env": {
|
|
109
|
+
"CB_CONNECTION_STRING": "couchbases://connection-string",
|
|
110
|
+
"CB_USERNAME": "username",
|
|
111
|
+
"CB_PASSWORD": "password",
|
|
112
|
+
"CB_BUCKET_NAME": "bucket_name"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
> 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!
|
|
120
|
+
|
|
121
|
+
> Note: If you have other MCP servers in use in the client, you can add it to the existing `mcpServers` object.
|
|
122
|
+
|
|
123
|
+
### Additional Configuration for MCP Server
|
|
124
|
+
|
|
125
|
+
The server can be configured using environment variables or command line arguments:
|
|
126
|
+
|
|
127
|
+
| Environment Variable | CLI Argument | Description | Default |
|
|
128
|
+
| ----------------------------- | ------------------------ | ------------------------------------------ | ------------ |
|
|
129
|
+
| `CB_CONNECTION_STRING` | `--connection-string` | Connection string to the Couchbase cluster | **Required** |
|
|
130
|
+
| `CB_USERNAME` | `--username` | Username with bucket access | **Required** |
|
|
131
|
+
| `CB_PASSWORD` | `--password` | Password for authentication | **Required** |
|
|
132
|
+
| `CB_BUCKET_NAME` | `--bucket-name` | Name of the bucket to access | **Required** |
|
|
133
|
+
| `CB_MCP_READ_ONLY_QUERY_MODE` | `--read-only-query-mode` | Prevent data modification queries | `true` |
|
|
134
|
+
| `CB_MCP_TRANSPORT` | `--transport` | Transport mode: `stdio`, `http`, `sse` | `stdio` |
|
|
135
|
+
| `CB_MCP_HOST` | `--host` | Host for HTTP/SSE transport modes | `127.0.0.1` |
|
|
136
|
+
| `CB_MCP_PORT` | `--port` | Port for HTTP/SSE transport modes | `8000` |
|
|
137
|
+
|
|
138
|
+
You can also check the version of the server using:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
uvx couchbase-mcp-server --version
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### Client Specific Configuration
|
|
145
|
+
|
|
146
|
+
<details>
|
|
147
|
+
<summary>Claude Desktop</summary>
|
|
148
|
+
|
|
149
|
+
Follow the steps below to use Couchbase MCP server with Claude Desktop MCP client
|
|
150
|
+
|
|
151
|
+
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](https://modelcontextprotocol.io/quickstart/user).
|
|
152
|
+
|
|
153
|
+
- On Mac, the configuration file is located at `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
154
|
+
- On Windows, the configuration file is located at `%APPDATA%\Claude\claude_desktop_config.json`
|
|
155
|
+
|
|
156
|
+
Open the configuration file and add the [configuration](#configuration) to the `mcpServers` section.
|
|
157
|
+
|
|
158
|
+
2. Restart Claude Desktop to apply the changes.
|
|
159
|
+
|
|
160
|
+
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.
|
|
161
|
+
|
|
162
|
+
Logs
|
|
163
|
+
|
|
164
|
+
The logs for Claude Desktop can be found in the following locations:
|
|
165
|
+
|
|
166
|
+
- MacOS: ~/Library/Logs/Claude
|
|
167
|
+
- Windows: %APPDATA%\Claude\Logs
|
|
168
|
+
|
|
169
|
+
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](https://modelcontextprotocol.io/quickstart/user#troubleshooting).
|
|
170
|
+
|
|
171
|
+
</details>
|
|
172
|
+
|
|
173
|
+
<details>
|
|
174
|
+
<summary>Cursor</summary>
|
|
175
|
+
|
|
176
|
+
Follow steps below to use Couchbase MCP server with Cursor:
|
|
177
|
+
|
|
178
|
+
1. Install [Cursor](https://cursor.sh/) on your machine.
|
|
179
|
+
|
|
180
|
+
2. In Cursor, go to Cursor > Cursor Settings > Tools & Integrations > MCP Tools. Also, checkout the docs on [setting up MCP server configuration](https://docs.cursor.com/en/context/mcp#configuring-mcp-servers) from Cursor.
|
|
181
|
+
|
|
182
|
+
3. Specify the same [configuration](#configuration). You may need to add the server configuration under a parent key of mcpServers.
|
|
183
|
+
|
|
184
|
+
4. Save the configuration.
|
|
185
|
+
|
|
186
|
+
5. You will see couchbase as an added server in MCP servers list. Refresh to see if server is enabled.
|
|
187
|
+
|
|
188
|
+
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.
|
|
189
|
+
|
|
190
|
+
For more details about MCP integration with Cursor, refer to the [official Cursor MCP documentation](https://docs.cursor.com/en/context/mcp).
|
|
191
|
+
|
|
192
|
+
Logs
|
|
193
|
+
|
|
194
|
+
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.
|
|
195
|
+
|
|
196
|
+
</details>
|
|
197
|
+
|
|
198
|
+
<details>
|
|
199
|
+
<summary>Windsurf Editor</summary>
|
|
200
|
+
|
|
201
|
+
Follow the steps below to use the Couchbase MCP server with [Windsurf Editor](https://windsurf.com/).
|
|
202
|
+
|
|
203
|
+
1. Install [Windsurf Editor](https://windsurf.com/download) on your machine.
|
|
204
|
+
|
|
205
|
+
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](https://docs.windsurf.com/windsurf/cascade/mcp#adding-a-new-mcp-plugin).
|
|
206
|
+
|
|
207
|
+
3. Click on Add Server and then Add custom server. On the configuration that opens in the editor, add the Couchbase MCP Server [configuration](#configuration) from above.
|
|
208
|
+
|
|
209
|
+
4. Save the configuration.
|
|
210
|
+
|
|
211
|
+
5. You will see couchbase as an added server in MCP Servers list under Advanced Settings. Refresh to see if server is enabled.
|
|
212
|
+
|
|
213
|
+
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.
|
|
214
|
+
|
|
215
|
+
For more details about MCP integration with Windsurf Editor, refer to the official [Windsurf MCP documentation](https://docs.windsurf.com/windsurf/cascade/mcp).
|
|
216
|
+
|
|
217
|
+
</details>
|
|
218
|
+
|
|
219
|
+
## Streamable HTTP Transport Mode
|
|
220
|
+
|
|
221
|
+
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.
|
|
222
|
+
Check if your [MCP client](https://modelcontextprotocol.io/clients) supports streamable http transport before attempting to connect to MCP server in this mode.
|
|
223
|
+
|
|
224
|
+
> Note: This mode does not include authorization support.
|
|
225
|
+
|
|
226
|
+
### Usage
|
|
227
|
+
|
|
228
|
+
By default, the MCP server will run on port 8000 but this can be configured using the `--port` or `CB_MCP_PORT` environment variable.
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
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
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
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.
|
|
235
|
+
|
|
236
|
+
### MCP Client Configuration
|
|
237
|
+
|
|
238
|
+
```json
|
|
239
|
+
{
|
|
240
|
+
"mcpServers": {
|
|
241
|
+
"couchbase-http": {
|
|
242
|
+
"url": "http://localhost:8000/mcp"
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## SSE Transport Mode
|
|
249
|
+
|
|
250
|
+
There is an option to run the MCP server in [Server-Sent Events (SSE)](https://modelcontextprotocol.io/specification/2024-11-05/basic/transports#http-with-sse) transport mode.
|
|
251
|
+
|
|
252
|
+
> Note: SSE mode has been [deprecated](https://modelcontextprotocol.io/docs/concepts/transports#server-sent-events-sse-deprecated) by MCP. We have support for [Streamable HTTP](#streamable-http-transport-mode).
|
|
253
|
+
|
|
254
|
+
### Usage
|
|
255
|
+
|
|
256
|
+
By default, the MCP server will run on port 8000 but this can be configured using the `--port` or `CB_MCP_PORT` environment variable.
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
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
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
The server will be available on http://localhost:8000/sse. This can be used in MCP clients supporting SSE transport mode such as Cursor.
|
|
263
|
+
|
|
264
|
+
### MCP Client Configuration
|
|
265
|
+
|
|
266
|
+
```json
|
|
267
|
+
{
|
|
268
|
+
"mcpServers": {
|
|
269
|
+
"couchbase-sse": {
|
|
270
|
+
"url": "http://localhost:8000/sse"
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Docker Image
|
|
277
|
+
|
|
278
|
+
The MCP server can also be built and run as a Docker container. Prebuilt images can be found on [DockerHub](https://hub.docker.com/r/couchbaseecosystem/mcp-server-couchbase).
|
|
279
|
+
|
|
280
|
+
Alternatively, we are part of the [Docker MCP Catalog](https://hub.docker.com/mcp/server/couchbase/overview).
|
|
281
|
+
|
|
282
|
+
### Building Image
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
docker build -t mcp/couchbase .
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
<details>
|
|
289
|
+
<summary>Building with Arguments</summary>
|
|
290
|
+
If you want to build with the build arguments for commit hash and the build time, you can build using:
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
docker build --build-arg GIT_COMMIT_HASH=$(git rev-parse HEAD) \
|
|
294
|
+
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
|
|
295
|
+
-t mcp/couchbase .
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
**Alternatively, use the provided build script:**
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
./build.sh
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
This script automatically:
|
|
305
|
+
|
|
306
|
+
- Generates git commit hash and build timestamp
|
|
307
|
+
- Creates multiple useful tags (`latest`, `<short-commit>`)
|
|
308
|
+
- Shows build information and results
|
|
309
|
+
- Uses the same arguments as CI/CD builds
|
|
310
|
+
|
|
311
|
+
**Verify image labels:**
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
# View git commit hash in image
|
|
315
|
+
docker inspect --format='{{index .Config.Labels "org.opencontainers.image.revision"}}' mcp/couchbase:latest
|
|
316
|
+
|
|
317
|
+
# View all metadata labels
|
|
318
|
+
docker inspect --format='{{json .Config.Labels}}' mcp/couchbase:latest
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
</details>
|
|
322
|
+
|
|
323
|
+
### Running
|
|
324
|
+
|
|
325
|
+
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](#server-configuration-for-mcp-clients).
|
|
326
|
+
|
|
327
|
+
#### Independent Docker Container
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
docker run --rm -i \
|
|
331
|
+
-e CB_CONNECTION_STRING='<couchbase_connection_string>' \
|
|
332
|
+
-e CB_USERNAME='<database_user>' \
|
|
333
|
+
-e CB_PASSWORD='<database_password>' \
|
|
334
|
+
-e CB_BUCKET_NAME='<bucket_name>' \
|
|
335
|
+
-e CB_MCP_TRANSPORT='<http|sse|stdio>' \
|
|
336
|
+
-e CB_MCP_READ_ONLY_QUERY_MODE='<true|false>' \
|
|
337
|
+
-e CB_MCP_PORT=9001 \
|
|
338
|
+
-p 9001:9001 \
|
|
339
|
+
mcp/couchbase
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
The `CB_MCP_PORT` environment variable is only applicable in the case of HTTP transport modes like http and sse.
|
|
343
|
+
|
|
344
|
+
#### MCP Client Configuration
|
|
345
|
+
|
|
346
|
+
The Docker image can be used in `stdio` transport mode with the following configuration.
|
|
347
|
+
|
|
348
|
+
```json
|
|
349
|
+
{
|
|
350
|
+
"mcpServers": {
|
|
351
|
+
"couchbase-mcp-docker": {
|
|
352
|
+
"command": "docker",
|
|
353
|
+
"args": [
|
|
354
|
+
"run",
|
|
355
|
+
"--rm",
|
|
356
|
+
"-i",
|
|
357
|
+
"-e",
|
|
358
|
+
"CB_CONNECTION_STRING=<couchbase_connection_string>",
|
|
359
|
+
"-e",
|
|
360
|
+
"CB_USERNAME=<database_user>",
|
|
361
|
+
"-e",
|
|
362
|
+
"CB_PASSWORD=<database_password>",
|
|
363
|
+
"-e",
|
|
364
|
+
"CB_BUCKET_NAME=<bucket_name>",
|
|
365
|
+
"mcp/couchbase"
|
|
366
|
+
]
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Notes
|
|
373
|
+
|
|
374
|
+
- 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](https://docs.docker.com/desktop/features/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host).
|
|
375
|
+
- 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](https://docs.docker.com/engine/network/drivers/).
|
|
376
|
+
|
|
377
|
+
### Risks Associated with LLMs
|
|
378
|
+
|
|
379
|
+
- The use of large language models and similar technology involves risks, including the potential for inaccurate or harmful outputs.
|
|
380
|
+
- Couchbase does not review or evaluate the quality or accuracy of such outputs, and such outputs may not reflect Couchbase's views.
|
|
381
|
+
- 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.
|
|
382
|
+
|
|
383
|
+
### Managed MCP Server
|
|
384
|
+
|
|
385
|
+
The Couchbase MCP server can also be used as a managed server in your agentic applications via [Smithery.ai](https://smithery.ai/server/@Couchbase-Ecosystem/mcp-server-couchbase).
|
|
386
|
+
|
|
387
|
+
## Troubleshooting Tips
|
|
388
|
+
|
|
389
|
+
- Ensure the path to your MCP server repository is correct in the configuration if running from source.
|
|
390
|
+
- Verify that your Couchbase connection string, database username, password and bucket name are correct.
|
|
391
|
+
- If using Couchbase Capella, ensure that the cluster is [accessible](https://docs.couchbase.com/cloud/clusters/allow-ip-address.html) from the machine where the MCP server is running.
|
|
392
|
+
- Check that the database user has proper permissions to access the specified bucket.
|
|
393
|
+
- 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.
|
|
394
|
+
- 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`.
|
|
395
|
+
- 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](https://docs.astral.sh/uv/concepts/projects/sync/#syncing-the-environment).
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## 👩💻 Contributing
|
|
400
|
+
|
|
401
|
+
We welcome contributions from the community! Whether you want to fix bugs, add features, or improve documentation, your help is appreciated.
|
|
402
|
+
|
|
403
|
+
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](https://github.com/Couchbase-Ecosystem/mcp-server-couchbase/issues).
|
|
404
|
+
|
|
405
|
+
### For Developers
|
|
406
|
+
|
|
407
|
+
If you're interested in contributing code or setting up a development environment:
|
|
408
|
+
|
|
409
|
+
📖 **See [CONTRIBUTING.md](CONTRIBUTING.md)** for comprehensive developer setup instructions, including:
|
|
410
|
+
|
|
411
|
+
- Development environment setup with `uv`
|
|
412
|
+
- Code linting and formatting with Ruff
|
|
413
|
+
- Pre-commit hooks installation
|
|
414
|
+
- Project structure overview
|
|
415
|
+
- Development workflow and practices
|
|
416
|
+
|
|
417
|
+
### Quick Start for Contributors
|
|
418
|
+
|
|
419
|
+
```bash
|
|
420
|
+
# Clone and setup
|
|
421
|
+
git clone https://github.com/Couchbase-Ecosystem/mcp-server-couchbase.git
|
|
422
|
+
cd mcp-server-couchbase
|
|
423
|
+
|
|
424
|
+
# Install with development dependencies
|
|
425
|
+
uv sync --extra dev
|
|
426
|
+
|
|
427
|
+
# Install pre-commit hooks
|
|
428
|
+
uv run pre-commit install
|
|
429
|
+
|
|
430
|
+
# Run linting
|
|
431
|
+
./scripts/lint.sh
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
## 📢 Support Policy
|
|
437
|
+
|
|
438
|
+
We truly appreciate your interest in this project!
|
|
439
|
+
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.
|
|
440
|
+
|
|
441
|
+
Our support portal is unable to assist with requests related to this project, so we kindly ask that all inquiries stay within GitHub.
|
|
442
|
+
|
|
443
|
+
Your collaboration helps us all move forward together — thank you!
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
mcp_server.py,sha256=t-TFlzAPH0qUILFjX33n6VnEvTgWAjCRy3HrKkKosWE,4416
|
|
2
|
+
couchbase_mcp_server-0.4.0rc1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
3
|
+
tools/__init__.py,sha256=jVvVnpoSJrYFmxAnx2vkyAuKZ1-Ti1fzdIgbO0yqAcM,1097
|
|
4
|
+
tools/kv.py,sha256=LDDASE4nD4oiTkDzSSYIrmvleqn7e8W-14UOql_SWK8,2199
|
|
5
|
+
tools/query.py,sha256=BYpJkgiCAINqgreW22uk-6JjrKrZkswGYKRhU1l-jLI,2901
|
|
6
|
+
tools/server.py,sha256=a4rDDDYO7WNTcKN8KjiQlnsIZ1_ydlAVgIy5nxxic5g,3251
|
|
7
|
+
utils/__init__.py,sha256=E7Puxqate6J5xdNWSzLFU33UfsbSGE9B4aiMB696v04,1353
|
|
8
|
+
utils/config.py,sha256=vCZfyhQXnbTPwcJi3YfLTXqqirCeHVTSyHui5_aGchs,1136
|
|
9
|
+
utils/connection.py,sha256=2a_syAAMFE2zHEFMzsOJGz4Vhz6Tq3lgna3qfhKva0w,1520
|
|
10
|
+
utils/constants.py,sha256=w0zvQ1zMzJBg44Yl3aQW8KfaaRPn0BgPOLEe8xLeLSE,487
|
|
11
|
+
utils/context.py,sha256=pepc4sCUsmx0itpoJ28_TS03mSXJbQhgTZcN7NAvvTg,3013
|
|
12
|
+
couchbase_mcp_server-0.4.0rc1.dist-info/METADATA,sha256=_hBu07b23dHcalDuRUAS_IM-3N_yxggsKbxGGn-WM6E,19329
|
|
13
|
+
couchbase_mcp_server-0.4.0rc1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
couchbase_mcp_server-0.4.0rc1.dist-info/entry_points.txt,sha256=iU5pF4kIMTnNhoMPHhdH-k8o1Fmxb_iM9qJHCZcL6Ak,57
|
|
15
|
+
couchbase_mcp_server-0.4.0rc1.dist-info/top_level.txt,sha256=cQeSKgjLtHXStynG6fJkj8o4tBep9OkDai_4h5bf_4I,23
|
|
16
|
+
couchbase_mcp_server-0.4.0rc1.dist-info/RECORD,,
|
mcp_server.py
CHANGED
|
@@ -14,10 +14,15 @@ from tools import ALL_TOOLS
|
|
|
14
14
|
|
|
15
15
|
# Import utilities
|
|
16
16
|
from utils import (
|
|
17
|
+
ALLOWED_TRANSPORTS,
|
|
18
|
+
DEFAULT_HOST,
|
|
17
19
|
DEFAULT_LOG_LEVEL,
|
|
20
|
+
DEFAULT_PORT,
|
|
18
21
|
DEFAULT_READ_ONLY_MODE,
|
|
19
22
|
DEFAULT_TRANSPORT,
|
|
20
23
|
MCP_SERVER_NAME,
|
|
24
|
+
NETWORK_TRANSPORTS,
|
|
25
|
+
NETWORK_TRANSPORTS_SDK_MAPPING,
|
|
21
26
|
AppContext,
|
|
22
27
|
get_settings,
|
|
23
28
|
)
|
|
@@ -79,18 +84,37 @@ async def app_lifespan(server: FastMCP) -> AsyncIterator[AppContext]:
|
|
|
79
84
|
)
|
|
80
85
|
@click.option(
|
|
81
86
|
"--read-only-query-mode",
|
|
82
|
-
envvar=
|
|
87
|
+
envvar=[
|
|
88
|
+
"CB_MCP_READ_ONLY_QUERY_MODE",
|
|
89
|
+
"READ_ONLY_QUERY_MODE", # Deprecated
|
|
90
|
+
],
|
|
83
91
|
type=bool,
|
|
84
92
|
default=DEFAULT_READ_ONLY_MODE,
|
|
85
93
|
help="Enable read-only query mode. Set to True (default) to allow only read-only queries. Can be set to False to allow data modification queries.",
|
|
86
94
|
)
|
|
87
95
|
@click.option(
|
|
88
96
|
"--transport",
|
|
89
|
-
envvar=
|
|
90
|
-
|
|
97
|
+
envvar=[
|
|
98
|
+
"CB_MCP_TRANSPORT",
|
|
99
|
+
"MCP_TRANSPORT", # Deprecated
|
|
100
|
+
],
|
|
101
|
+
type=click.Choice(ALLOWED_TRANSPORTS),
|
|
91
102
|
default=DEFAULT_TRANSPORT,
|
|
92
|
-
help="Transport mode for the server (stdio or sse)",
|
|
103
|
+
help="Transport mode for the server (stdio, http or sse). Default is stdio",
|
|
93
104
|
)
|
|
105
|
+
@click.option(
|
|
106
|
+
"--host",
|
|
107
|
+
envvar="CB_MCP_HOST",
|
|
108
|
+
default=DEFAULT_HOST,
|
|
109
|
+
help="Host to run the server on (default: 127.0.0.1)",
|
|
110
|
+
)
|
|
111
|
+
@click.option(
|
|
112
|
+
"--port",
|
|
113
|
+
envvar="CB_MCP_PORT",
|
|
114
|
+
default=DEFAULT_PORT,
|
|
115
|
+
help="Port to run the server on (default: 8000)",
|
|
116
|
+
)
|
|
117
|
+
@click.version_option(package_name="couchbase-mcp-server")
|
|
94
118
|
@click.pass_context
|
|
95
119
|
def main(
|
|
96
120
|
ctx,
|
|
@@ -100,6 +124,8 @@ def main(
|
|
|
100
124
|
bucket_name,
|
|
101
125
|
read_only_query_mode,
|
|
102
126
|
transport,
|
|
127
|
+
host,
|
|
128
|
+
port,
|
|
103
129
|
):
|
|
104
130
|
"""Couchbase MCP Server"""
|
|
105
131
|
# Store configuration in context
|
|
@@ -109,17 +135,33 @@ def main(
|
|
|
109
135
|
"password": password,
|
|
110
136
|
"bucket_name": bucket_name,
|
|
111
137
|
"read_only_query_mode": read_only_query_mode,
|
|
138
|
+
"transport": transport,
|
|
139
|
+
"host": host,
|
|
140
|
+
"port": port,
|
|
112
141
|
}
|
|
113
142
|
|
|
114
|
-
#
|
|
115
|
-
|
|
143
|
+
# Map user-friendly transport names to SDK transport names
|
|
144
|
+
sdk_transport = NETWORK_TRANSPORTS_SDK_MAPPING.get(transport, transport)
|
|
145
|
+
|
|
146
|
+
# If the transport is network based, we need to pass the host and port to the MCP server
|
|
147
|
+
config = (
|
|
148
|
+
{
|
|
149
|
+
"host": host,
|
|
150
|
+
"port": port,
|
|
151
|
+
"transport": sdk_transport,
|
|
152
|
+
}
|
|
153
|
+
if transport in NETWORK_TRANSPORTS
|
|
154
|
+
else {}
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
mcp = FastMCP(MCP_SERVER_NAME, lifespan=app_lifespan, **config)
|
|
116
158
|
|
|
117
159
|
# Register all tools
|
|
118
160
|
for tool in ALL_TOOLS:
|
|
119
161
|
mcp.add_tool(tool)
|
|
120
162
|
|
|
121
163
|
# Run the server
|
|
122
|
-
mcp.run(transport=
|
|
164
|
+
mcp.run(transport=sdk_transport) # type: ignore
|
|
123
165
|
|
|
124
166
|
|
|
125
167
|
if __name__ == "__main__":
|
tools/__init__.py
CHANGED
|
@@ -21,13 +21,13 @@ from .query import (
|
|
|
21
21
|
from .server import (
|
|
22
22
|
get_scopes_and_collections_in_bucket,
|
|
23
23
|
get_server_configuration_status,
|
|
24
|
-
|
|
24
|
+
test_cluster_connection,
|
|
25
25
|
)
|
|
26
26
|
|
|
27
27
|
# List of all tools for easy registration
|
|
28
28
|
ALL_TOOLS = [
|
|
29
29
|
get_server_configuration_status,
|
|
30
|
-
|
|
30
|
+
test_cluster_connection,
|
|
31
31
|
get_scopes_and_collections_in_bucket,
|
|
32
32
|
get_document_by_id,
|
|
33
33
|
upsert_document_by_id,
|
|
@@ -39,7 +39,7 @@ ALL_TOOLS = [
|
|
|
39
39
|
__all__ = [
|
|
40
40
|
# Individual tools
|
|
41
41
|
"get_server_configuration_status",
|
|
42
|
-
"
|
|
42
|
+
"test_cluster_connection",
|
|
43
43
|
"get_scopes_and_collections_in_bucket",
|
|
44
44
|
"get_document_by_id",
|
|
45
45
|
"upsert_document_by_id",
|
tools/query.py
CHANGED
|
@@ -18,17 +18,21 @@ logger = logging.getLogger(f"{MCP_SERVER_NAME}.tools.query")
|
|
|
18
18
|
|
|
19
19
|
def get_schema_for_collection(
|
|
20
20
|
ctx: Context, scope_name: str, collection_name: str
|
|
21
|
-
) ->
|
|
21
|
+
) -> dict[str, Any]:
|
|
22
22
|
"""Get the schema for a collection in the specified scope.
|
|
23
|
-
Returns a dictionary with the schema returned by running INFER on the Couchbase collection.
|
|
23
|
+
Returns a dictionary with the collection name and the schema returned by running INFER query on the Couchbase collection.
|
|
24
24
|
"""
|
|
25
|
+
schema = {"collection_name": collection_name, "schema": []}
|
|
25
26
|
try:
|
|
26
27
|
query = f"INFER {collection_name}"
|
|
27
28
|
result = run_sql_plus_plus_query(ctx, scope_name, query)
|
|
28
|
-
|
|
29
|
+
# Result is a list of list of schemas. We convert it to a list of schemas.
|
|
30
|
+
if result:
|
|
31
|
+
schema["schema"] = result[0]
|
|
29
32
|
except Exception as e:
|
|
30
33
|
logger.error(f"Error getting schema: {e}")
|
|
31
34
|
raise
|
|
35
|
+
return schema
|
|
32
36
|
|
|
33
37
|
|
|
34
38
|
def run_sql_plus_plus_query(
|
tools/server.py
CHANGED
|
@@ -17,8 +17,8 @@ logger = logging.getLogger(f"{MCP_SERVER_NAME}.tools.server")
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def get_server_configuration_status(ctx: Context) -> dict[str, Any]:
|
|
20
|
-
"""Get the server status and configuration without establishing
|
|
21
|
-
This tool can be used to verify the server is running and check configuration.
|
|
20
|
+
"""Get the server status and configuration without establishing connection.
|
|
21
|
+
This tool can be used to verify if the server is running and check the configuration.
|
|
22
22
|
"""
|
|
23
23
|
settings = get_settings()
|
|
24
24
|
|
|
@@ -45,8 +45,9 @@ def get_server_configuration_status(ctx: Context) -> dict[str, Any]:
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
def
|
|
48
|
+
def test_cluster_connection(ctx: Context) -> dict[str, Any]:
|
|
49
49
|
"""Test the connection to Couchbase cluster and bucket.
|
|
50
|
+
This tool verifies the connection to the Couchbase cluster and bucket by establishing the connection if it is not already established.
|
|
50
51
|
Returns connection status and basic cluster information.
|
|
51
52
|
"""
|
|
52
53
|
try:
|
utils/__init__.py
CHANGED
|
@@ -19,10 +19,15 @@ from .connection import (
|
|
|
19
19
|
|
|
20
20
|
# Constants
|
|
21
21
|
from .constants import (
|
|
22
|
+
ALLOWED_TRANSPORTS,
|
|
23
|
+
DEFAULT_HOST,
|
|
22
24
|
DEFAULT_LOG_LEVEL,
|
|
25
|
+
DEFAULT_PORT,
|
|
23
26
|
DEFAULT_READ_ONLY_MODE,
|
|
24
27
|
DEFAULT_TRANSPORT,
|
|
25
28
|
MCP_SERVER_NAME,
|
|
29
|
+
NETWORK_TRANSPORTS,
|
|
30
|
+
NETWORK_TRANSPORTS_SDK_MAPPING,
|
|
26
31
|
)
|
|
27
32
|
|
|
28
33
|
# Context utilities
|
|
@@ -50,4 +55,9 @@ __all__ = [
|
|
|
50
55
|
"DEFAULT_READ_ONLY_MODE",
|
|
51
56
|
"DEFAULT_TRANSPORT",
|
|
52
57
|
"DEFAULT_LOG_LEVEL",
|
|
58
|
+
"DEFAULT_HOST",
|
|
59
|
+
"DEFAULT_PORT",
|
|
60
|
+
"ALLOWED_TRANSPORTS",
|
|
61
|
+
"NETWORK_TRANSPORTS",
|
|
62
|
+
"NETWORK_TRANSPORTS_SDK_MAPPING",
|
|
53
63
|
]
|
utils/constants.py
CHANGED
|
@@ -4,6 +4,16 @@ MCP_SERVER_NAME = "couchbase"
|
|
|
4
4
|
# Default Configuration Values
|
|
5
5
|
DEFAULT_READ_ONLY_MODE = True
|
|
6
6
|
DEFAULT_TRANSPORT = "stdio"
|
|
7
|
+
DEFAULT_HOST = "127.0.0.1"
|
|
8
|
+
DEFAULT_PORT = 8000
|
|
9
|
+
|
|
10
|
+
# Allowed Transport Types
|
|
11
|
+
ALLOWED_TRANSPORTS = ["stdio", "http", "sse"]
|
|
12
|
+
NETWORK_TRANSPORTS = ["http", "sse"]
|
|
13
|
+
NETWORK_TRANSPORTS_SDK_MAPPING = {
|
|
14
|
+
"http": "streamable-http",
|
|
15
|
+
"sse": "sse",
|
|
16
|
+
}
|
|
7
17
|
|
|
8
18
|
# Logging Configuration
|
|
9
19
|
# Change this to DEBUG, WARNING, ERROR as needed
|
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: couchbase-mcp-server
|
|
3
|
-
Version: 0.3.1rc2
|
|
4
|
-
Summary: Couchbase MCP Server - The Developer Data Platform for Critical Applications in Our AI World
|
|
5
|
-
Author-email: Nithish Raghunandanan <devadvocates@couchbase.com>
|
|
6
|
-
License-Expression: Apache-2.0
|
|
7
|
-
Project-URL: Homepage, https://github.com/Couchbase-Ecosystem/mcp-server-couchbase
|
|
8
|
-
Project-URL: Documentation, https://github.com/Couchbase-Ecosystem/mcp-server-couchbase#readme
|
|
9
|
-
Project-URL: Issues, https://github.com/Couchbase-Ecosystem/mcp-server-couchbase/issues
|
|
10
|
-
Classifier: Development Status :: 4 - Beta
|
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier: Topic :: Database
|
|
13
|
-
Requires-Python: >=3.10
|
|
14
|
-
Description-Content-Type: text/markdown
|
|
15
|
-
License-File: LICENSE
|
|
16
|
-
Requires-Dist: click==8.2.1
|
|
17
|
-
Requires-Dist: couchbase==4.4.0
|
|
18
|
-
Requires-Dist: lark-sqlpp==0.0.1
|
|
19
|
-
Requires-Dist: mcp[cli]==1.6.0
|
|
20
|
-
Provides-Extra: dev
|
|
21
|
-
Requires-Dist: ruff>=0.8.0; extra == "dev"
|
|
22
|
-
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
|
|
23
|
-
Dynamic: license-file
|
|
24
|
-
|
|
25
|
-
# Couchbase MCP Server
|
|
26
|
-
|
|
27
|
-
An [MCP](https://modelcontextprotocol.io/) server implementation of Couchbase that allows LLMs to directly interact with Couchbase clusters.
|
|
28
|
-
|
|
29
|
-
## Features
|
|
30
|
-
|
|
31
|
-
- Get a list of all the scopes and collections in the specified bucket
|
|
32
|
-
- Get the structure for a collection
|
|
33
|
-
- Get a document by ID from a specified scope and collection
|
|
34
|
-
- Upsert a document by ID to a specified scope and collection
|
|
35
|
-
- Delete a document by ID from a specified scope and collection
|
|
36
|
-
- Run a [SQL++ query](https://www.couchbase.com/sqlplusplus/) on a specified scope
|
|
37
|
-
- 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.
|
|
38
|
-
|
|
39
|
-
## Prerequisites
|
|
40
|
-
|
|
41
|
-
- Python 3.10 or higher.
|
|
42
|
-
- A running Couchbase cluster. The easiest way to get started is to use [Capella](https://docs.couchbase.com/cloud/get-started/create-account.html#getting-started) free tier, which is fully managed version of Couchbase server. You can follow [instructions](https://docs.couchbase.com/cloud/clusters/data-service/import-data-documents.html#import-sample-data) to import one of the sample datasets or import your own.
|
|
43
|
-
- [uv](https://docs.astral.sh/uv/) installed to run the server.
|
|
44
|
-
- An [MCP client](https://modelcontextprotocol.io/clients) such as [Claude Desktop](https://claude.ai/download) installed to connect the server to Claude. The instructions are provided for Claude Desktop and Cursor. Other MCP clients could be used as well.
|
|
45
|
-
|
|
46
|
-
## Configuration
|
|
47
|
-
|
|
48
|
-
Clone the repository to your local machine.
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
git clone https://github.com/Couchbase-Ecosystem/mcp-server-couchbase.git
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Server Configuration for MCP Clients
|
|
55
|
-
|
|
56
|
-
This is the common configuration for the MCP clients such as Claude Desktop, Cursor, Windsurf Editor.
|
|
57
|
-
|
|
58
|
-
```json
|
|
59
|
-
{
|
|
60
|
-
"mcpServers": {
|
|
61
|
-
"couchbase": {
|
|
62
|
-
"command": "uv",
|
|
63
|
-
"args": [
|
|
64
|
-
"--directory",
|
|
65
|
-
"path/to/cloned/repo/mcp-server-couchbase/",
|
|
66
|
-
"run",
|
|
67
|
-
"src/mcp_server.py"
|
|
68
|
-
],
|
|
69
|
-
"env": {
|
|
70
|
-
"CB_CONNECTION_STRING": "couchbases://connection-string",
|
|
71
|
-
"CB_USERNAME": "username",
|
|
72
|
-
"CB_PASSWORD": "password",
|
|
73
|
-
"CB_BUCKET_NAME": "bucket_name"
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
The server can be configured using environment variables. The following variables are supported:
|
|
81
|
-
|
|
82
|
-
- `CB_CONNECTION_STRING`: The connection string to the Couchbase cluster
|
|
83
|
-
- `CB_USERNAME`: The username with access to the bucket to use to connect
|
|
84
|
-
- `CB_PASSWORD`: The password for the username to connect
|
|
85
|
-
- `CB_BUCKET_NAME`: The name of the bucket that the server will access
|
|
86
|
-
- `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.
|
|
87
|
-
- `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!
|
|
88
|
-
|
|
89
|
-
> Note: If you have other MCP servers in use in the client, you can add it to the existing `mcpServers` object.
|
|
90
|
-
|
|
91
|
-
### Claude Desktop
|
|
92
|
-
|
|
93
|
-
Follow the steps below to use Couchbase MCP server with Claude Desktop MCP client
|
|
94
|
-
|
|
95
|
-
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](https://modelcontextprotocol.io/quickstart/user).
|
|
96
|
-
|
|
97
|
-
- On Mac, the configuration file is located at `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
98
|
-
- On Windows, the configuration file is located at `%APPDATA%\Claude\claude_desktop_config.json`
|
|
99
|
-
|
|
100
|
-
Open the configuration file and add the [configuration](#server-configuration-for-mcp-clients) to the `mcpServers` section.
|
|
101
|
-
|
|
102
|
-
2. Restart Claude Desktop to apply the changes.
|
|
103
|
-
|
|
104
|
-
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.
|
|
105
|
-
|
|
106
|
-
#### Claude Desktop Logs
|
|
107
|
-
|
|
108
|
-
The logs for Claude Desktop can be found in the following locations:
|
|
109
|
-
|
|
110
|
-
- MacOS: ~/Library/Logs/Claude
|
|
111
|
-
- Windows: %APPDATA%\Claude\Logs
|
|
112
|
-
|
|
113
|
-
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](https://modelcontextprotocol.io/quickstart/user#getting-logs-from-claude-for-desktop).
|
|
114
|
-
|
|
115
|
-
### Cursor
|
|
116
|
-
|
|
117
|
-
Follow steps below to use Couchbase MCP server with Cursor:
|
|
118
|
-
|
|
119
|
-
1. Install [Cursor](https://cursor.sh/) on your machine.
|
|
120
|
-
|
|
121
|
-
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](https://docs.cursor.com/context/model-context-protocol#configuring-mcp-servers) from Cursor.
|
|
122
|
-
|
|
123
|
-
3. Specify the same [configuration](#server-configuration-for-mcp-clients). You may need to add the server configuration under a parent key of mcpServers.
|
|
124
|
-
|
|
125
|
-
4. Save the configuration.
|
|
126
|
-
|
|
127
|
-
5. You will see couchbase as an added server in MCP servers list. Refresh to see if server is enabled.
|
|
128
|
-
|
|
129
|
-
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.
|
|
130
|
-
|
|
131
|
-
For more details about MCP integration with Cursor, refer to the [official Cursor MCP documentation](https://docs.cursor.sh/ai-features/mcp-model-context-protocol).
|
|
132
|
-
|
|
133
|
-
#### Cursor Logs
|
|
134
|
-
|
|
135
|
-
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.
|
|
136
|
-
|
|
137
|
-
### Windsurf Editor
|
|
138
|
-
|
|
139
|
-
Follow the steps below to use the Couchbase MCP server with [Windsurf Editor](https://windsurf.com/).
|
|
140
|
-
|
|
141
|
-
1. Install [Windsurf Editor](https://windsurf.com/download) on your machine.
|
|
142
|
-
|
|
143
|
-
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](https://docs.windsurf.com/windsurf/mcp#configuring-mcp).
|
|
144
|
-
|
|
145
|
-
3. Click on Add Server and then Add custom server. On the configuration that opens in the editor, add the Couchbase MCP Server [configuration](#server-configuration-for-mcp-clients) from above.
|
|
146
|
-
|
|
147
|
-
4. Save the configuration.
|
|
148
|
-
|
|
149
|
-
5. You will see couchbase as an added server in MCP Servers list under Advanced Settings. Refresh to see if server is enabled.
|
|
150
|
-
|
|
151
|
-
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.
|
|
152
|
-
|
|
153
|
-
For more details about MCP integration with Windsurf Editor, refer to the official [Windsurf MCP documentation](https://docs.windsurf.com/windsurf/mcp).
|
|
154
|
-
|
|
155
|
-
### SSE Server Mode
|
|
156
|
-
|
|
157
|
-
There is an option to run the MCP server in [Server-Sent Events (SSE)](https://modelcontextprotocol.io/docs/concepts/transports#server-sent-events-sse) transport mode.
|
|
158
|
-
|
|
159
|
-
> Note: SSE mode has been [deprecated](https://modelcontextprotocol.io/docs/concepts/transports#server-sent-events-sse-deprecated) by MCP. We are investigating adding support for Streamable HTTP.
|
|
160
|
-
|
|
161
|
-
#### Usage
|
|
162
|
-
|
|
163
|
-
By default, the MCP server will run on port 8080 but this can be configured using the `FASTMCP_PORT` environment variable.
|
|
164
|
-
|
|
165
|
-
> 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
|
|
166
|
-
|
|
167
|
-
The server will be available on http://localhost:8080/sse. This can be used in MCP clients supporting SSE transport mode.
|
|
168
|
-
|
|
169
|
-
## Docker Image
|
|
170
|
-
|
|
171
|
-
The MCP server can also be built and run as a Docker container. Prebuilt images can be found on [DockerHub](https://hub.docker.com/r/couchbaseecosystem/mcp-server-couchbase).
|
|
172
|
-
|
|
173
|
-
```bash
|
|
174
|
-
docker build -t mcp/couchbase .
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
### Running
|
|
178
|
-
|
|
179
|
-
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](#server-configuration-for-mcp-clients)
|
|
180
|
-
|
|
181
|
-
```bash
|
|
182
|
-
docker run -i \
|
|
183
|
-
-e CB_CONNECTION_STRING='<couchbase_connection_string>' \
|
|
184
|
-
-e CB_USERNAME='<database_user>' \
|
|
185
|
-
-e CB_PASSWORD='<database_password>' \
|
|
186
|
-
-e CB_BUCKET_NAME='<bucket_name>' \
|
|
187
|
-
-e MCP_TRANSPORT='stdio/sse' \
|
|
188
|
-
-e READ_ONLY_QUERY_MODE="true/false" \
|
|
189
|
-
mcp/couchbase
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
### Risks Associated with LLMs
|
|
193
|
-
|
|
194
|
-
- The use of large language models and similar technology involves risks, including the potential for inaccurate or harmful outputs.
|
|
195
|
-
- Couchbase does not review or evaluate the quality or accuracy of such outputs, and such outputs may not reflect Couchbase's views.
|
|
196
|
-
- 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.
|
|
197
|
-
|
|
198
|
-
### Managed MCP Server
|
|
199
|
-
|
|
200
|
-
The Couchbase MCP server can also be used as a managed server in your agentic applications via [Smithery.ai](https://smithery.ai/server/@Couchbase-Ecosystem/mcp-server-couchbase).
|
|
201
|
-
|
|
202
|
-
## Troubleshooting Tips
|
|
203
|
-
|
|
204
|
-
- Ensure the path to your MCP server repository is correct in the configuration.
|
|
205
|
-
- Verify that your Couchbase connection string, database username, password and bucket name are correct.
|
|
206
|
-
- If using Couchbase Capella, ensure that the cluster is [accessible](https://docs.couchbase.com/cloud/clusters/allow-ip-address.html) from the machine where the MCP server is running.
|
|
207
|
-
- Check that the database user has proper permissions to access the specified bucket.
|
|
208
|
-
- 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.
|
|
209
|
-
- 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`.
|
|
210
|
-
|
|
211
|
-
---
|
|
212
|
-
|
|
213
|
-
## 👩💻 Contributing
|
|
214
|
-
|
|
215
|
-
We welcome contributions from the community! Whether you want to fix bugs, add features, or improve documentation, your help is appreciated.
|
|
216
|
-
|
|
217
|
-
### For Developers
|
|
218
|
-
|
|
219
|
-
If you're interested in contributing code or setting up a development environment:
|
|
220
|
-
|
|
221
|
-
📖 **See [CONTRIBUTING.md](CONTRIBUTING.md)** for comprehensive developer setup instructions, including:
|
|
222
|
-
|
|
223
|
-
- Development environment setup with `uv`
|
|
224
|
-
- Code linting and formatting with Ruff
|
|
225
|
-
- Pre-commit hooks installation
|
|
226
|
-
- Project structure overview
|
|
227
|
-
- Development workflow and practices
|
|
228
|
-
|
|
229
|
-
### Quick Start for Contributors
|
|
230
|
-
|
|
231
|
-
```bash
|
|
232
|
-
# Clone and setup
|
|
233
|
-
git clone https://github.com/Couchbase-Ecosystem/mcp-server-couchbase.git
|
|
234
|
-
cd mcp-server-couchbase
|
|
235
|
-
|
|
236
|
-
# Install with development dependencies
|
|
237
|
-
uv sync --extra dev
|
|
238
|
-
|
|
239
|
-
# Install pre-commit hooks
|
|
240
|
-
uv run pre-commit install
|
|
241
|
-
|
|
242
|
-
# Run linting
|
|
243
|
-
./scripts/lint.sh
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
---
|
|
247
|
-
|
|
248
|
-
## 📢 Support Policy
|
|
249
|
-
|
|
250
|
-
We truly appreciate your interest in this project!
|
|
251
|
-
This project is **community-maintained**, which means it's **not officially supported** by our support team.
|
|
252
|
-
|
|
253
|
-
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](https://github.com/Couchbase-Ecosystem/mcp-server-couchbase/issues).
|
|
254
|
-
Our support portal is unable to assist with requests related to this project, so we kindly ask that all inquiries stay within GitHub.
|
|
255
|
-
|
|
256
|
-
Your collaboration helps us all move forward together — thank you!
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
mcp_server.py,sha256=HX4oTcNRENDroo-SUcjJuv6RVsoGOVYeUVZzI2AdO4I,3288
|
|
2
|
-
couchbase_mcp_server-0.3.1rc2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
3
|
-
tools/__init__.py,sha256=qvqRJH2f7A4_npaekl0Zn8aarGnn-JKXyKxRdjBbRKE,1073
|
|
4
|
-
tools/kv.py,sha256=LDDASE4nD4oiTkDzSSYIrmvleqn7e8W-14UOql_SWK8,2199
|
|
5
|
-
tools/query.py,sha256=gRPFYhCmNsks9cdzW13mbRaSd7GMug4ElGEmaFCFL80,2674
|
|
6
|
-
tools/server.py,sha256=DatX96gdtFykQsplFns3oK2Dtnd6g2KNAX_d-adNzqI,3098
|
|
7
|
-
utils/__init__.py,sha256=vm7z5E7lVqMquvy-Bzp3DKi1gp8wuH4fmEfORBgSx-U,1103
|
|
8
|
-
utils/config.py,sha256=vCZfyhQXnbTPwcJi3YfLTXqqirCeHVTSyHui5_aGchs,1136
|
|
9
|
-
utils/connection.py,sha256=2a_syAAMFE2zHEFMzsOJGz4Vhz6Tq3lgna3qfhKva0w,1520
|
|
10
|
-
utils/constants.py,sha256=nPK2kWM5oeFspUndjTIo9-o_gy2qz1nUJy4jdl6Xcog,244
|
|
11
|
-
utils/context.py,sha256=pepc4sCUsmx0itpoJ28_TS03mSXJbQhgTZcN7NAvvTg,3013
|
|
12
|
-
couchbase_mcp_server-0.3.1rc2.dist-info/METADATA,sha256=ACO-SPChz8drd_nu8uU5kK1GlyawDNGyxDpc2tYgwgc,12422
|
|
13
|
-
couchbase_mcp_server-0.3.1rc2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
-
couchbase_mcp_server-0.3.1rc2.dist-info/entry_points.txt,sha256=OCh0CdMW70p1nW9ZB23FxEg15nYBltg3HWpxean_S90,50
|
|
15
|
-
couchbase_mcp_server-0.3.1rc2.dist-info/top_level.txt,sha256=cQeSKgjLtHXStynG6fJkj8o4tBep9OkDai_4h5bf_4I,23
|
|
16
|
-
couchbase_mcp_server-0.3.1rc2.dist-info/RECORD,,
|
|
File without changes
|
{couchbase_mcp_server-0.3.1rc2.dist-info → couchbase_mcp_server-0.4.0rc1.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{couchbase_mcp_server-0.3.1rc2.dist-info → couchbase_mcp_server-0.4.0rc1.dist-info}/top_level.txt
RENAMED
|
File without changes
|