Couchbase MCP Server (TypeScript/Bun Version)
LocalAbout Couchbase MCP Server (TypeScript/Bun Version)
A Couchbase MCP server implemented in TypeScript and Bun, for LLM clients that need to access cluster data and analyze queries. It also manages documentation and playbooks, with read-only query mode enabled by default.
Key features
- 01List collections and read, write, or delete documents
- 02Run SQL++ queries
- 03Analyze queries, indexes, and cluster status
- 04Manage documentation and playbooks
- 05Enable read-only query mode by default
Use cases
- 01Inspect Couchbase collection structures and documents
- 02Run SQL++ queries and analyze performance
- 03Review cluster health and query records
- 04Maintain server documentation and database playbooks
MCP support
It exposes Couchbase data operations, query analysis, documentation management, and playbook tools and resources to MCP clients. It supports stdio and SSE transports.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMECouchbase MCP Server (TypeScript/Bun Version)
An MCP server implementation of Couchbase that allows LLMs to directly interact with Couchbase clusters.
Features
Tools
Database Operations
get_scopes_and_collections: List all scopes and collections in the specified bucketget_schema_for_collection: Get the structure and schema for a specific collectionget_document_by_id: Retrieve a document by ID from a specified scope and collectionupsert_document_by_id: Create or update a document by ID in a specified scope and collectiondelete_document_by_id: Remove a document by ID from a specified scope and collectionrun_sql_plus_plus_query: Execute SQL++ queries on a specified scope
Query Analysis
get_detailed_indexes: Get comprehensive information about database indexesget_detailed_prepared_statements: View detailed information about prepared statementsget_system_vitals: Monitor system health metricsget_system_nodes: View information about cluster nodesget_most_expensive_queries: Identify queries with highest resource consumptionsuggest_query_optimizations: Get recommendations for query performance improvementsanalyze_document_structure: Analyze and understand document structure patternsget_document_type_examples: View example documents for different typesget_prepared_statements: List all prepared statementsget_indexes_to_drop: Identify unused or redundant indexesget_completed_requests: View completed query requestsget_system_indexes: List all system indexesget_primary_index_queries: Identify queries using primary indexesget_largest_result_count_queries: Find queries returning the most resultsget_largest_result_size_queries: Identify queries with largest result sizesget_most_frequent_queries: View most commonly executed queriesget_longest_running_queries: Identify queries with longest execution timesget_fatal_requests: View failed query requests
Documentation Management
list_documentation: List available documentation for the MCP server tools and featuresread_documentation: Read specific documentation entriescreate_documentation: Create new documentation entries for tools and featuresdelete_documentation: Remove documentation entriessync_documentation: Synchronize and update existing documentation
Playbook Management
list_playbooks: List available playbooks for database operations
Resources
- Database Structure Resource: Access and manage database structure information
- Schema Resource: Handle collection schemas and validation
- Document Resource: Manage document operations and CRUD functionality
- Query Resource: Handle SQL++ query operations and results
- Query Analysis Resource: Monitor and optimize query performance
- Documentation Resource: Manage tool and feature documentation
- Playbook Resource: Manage and execute database operation playbooks
Security Features
READ_ONLY_QUERY_MODE: Default enabled setting to prevent SQL++ queries from modifying data- Secure document operations through ID-based access
- Environment-based configuration for sensitive credentials
Prerequisites
- Bun 1.0 or higher
- A running Couchbase cluster. The easiest way to get started is to use Capella free tier, which is fully managed version of Couchbase server. You can follow instructions to import one of the sample datasets or import your own.
- An MCP client such as Claude Desktop installed to connect the server to Claude. The instructions are provided for Claude Desktop and Cursor. Other MCP clients could be used as well.
Configuration
Clone the repository to your local machine.
git clone https://github.com/yourusername/mcp-server-couchbase-bun.git
cd mcp-server-couchbase-bun
Install dependencies:
bun install
Build the TypeScript project:
bun run build
Create a .env file based on the example:
cp .env.example .env
# Edit .env with your Couchbase credentials
Server Configuration for MCP Clients
This is the configuration for the MCP clients such as Claude Desktop, Cursor, Windsurf Editor.
{
"mcpServers": {
"couchbase-capella-mcp": {
"command": "bun",
"args": [
"/path/to/your/mcp-server-couchbase/dist/index.js",
"--transport",
"stdio"
],
"env": {
"COUCHBASE_URL": "couchbases://your-cluster-url",
"COUCHBASE_USERNAME": "your-username",
"COUCHBASE_PASSWORD": "your-password",
"COUCHBASE_BUCKET": "your-bucket",
"COUCHBASE_SCOPE": "your-scope",
"COUCHBASE_COLLECTION": "your-collection",
"LOG_LEVEL": "debug",
"DOCS_ENABLED": "true",
"DOCS_BASE_DIR": "/path/to/your/mcp-server-couchbase/docs",
"DOCS_FILE_EXT": ".md",
"PWD": "/path/to/your/mcp-server-couchbase",
"PATH": "/Users/your-username/.bun/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
},
"cwd": "/path/to/your/mcp-server-couchbase"
}
}
}
Note: Replace all
/path/to/your/mcp-server-couchbasewith the actual path to your cloned repository. Also, update the environment variables with your specific Couchbase cluster details.
The server can be configured using environment variables. The following variables are supported:
Couchbase Connection Settings
COUCHBASE_URL: The connection string to the Couchbase clusterCOUCHBASE_USERNAME: The username with access to the bucket to use to connectCOUCHBASE_PASSWORD: The password for the username to connectCOUCHBASE_BUCKET: The name of the bucket that the server will accessCOUCHBASE_SCOPE: The scope to use within the bucketCOUCHBASE_COLLECTION: The collection to use within the scopeCN_ROOT: The root directory for Couchbase configuration (default: '/usr/src')
MCP Server Settings
MCP_SERVER_NAME: The name of the MCP server instanceMCP_TRANSPORT: The transport mode to use (stdio or sse)FASTMCP_PORT: The port number for SSE transport mode (default: 8080)READ_ONLY_QUERY_MODE: Setting to configure whether SQL++ queries that allow data to be modified are allowed (default: true)LOG_LEVEL: The logging level (e.g., "debug", "info", "warn", "error")
Documentation Settings
DOCS_ENABLED: Enable/disable documentation featuresDOCS_BASE_DIR: Base directory for documentation filesDOCS_FILE_EXT: File extension for documentation files
Playbook Settings
PLAYBOOKS_ENABLED: Enable/disable playbook featuresPLAYBOOKS_BASE_DIR: Base directory for playbook filesPLAYBOOKS_FILE_EXT: File extension for playbook files
System Settings
PWD: The working directory for the MCP server
Running the Server
You can run the server directly with:
# Development mode (TypeScript directly)
bun run dev
# Production mode (compiled JavaScript)
bun run start
For SSE transport mode:
# Development mode (TypeScript directly)
bun run dev:sse
# Production mode (compiled JavaScript)
bun run start:sse
Client Setup Instructions
Setup instructions for Claude Desktop, Cursor, and Windsurf Editor remain the same as the original Python version, just adjust the command to use bun instead of uv.
SSE Server Mode
There is an option to run the MCP server in Server-Sent Events (SSE) transport mode.
Usage
By default, the MCP server will run on port 8080 but this can be configured using the FASTMCP_PORT environment variable.
bun run dist/mcp_server.js --connection-string='<couchbase_connection_string>' --username='<database_username>' --password='<database_password>' --bucket-name='<couchbase_bucket_to_use>' --read-only-query-mode=true --transport=sse
The server will be available on http://localhost:8080/sse. This can be used in MCP clients supporting SSE transport mode.
Risks Associated with LLMs
- The use of large language models and similar technology involves risks, including the potential for inaccurate or harmful outputs.
- Couchbase does not review or evaluate the quality or accuracy of such outputs, and such outputs may not reflect Couchbase's views.
- You are solely responsible for determining whether to use large language models and related technology, and for complying with any license terms, terms of use, and your organization's policies governing your use of the same.
TypeScript Implementation Notes
This implementation offers several advantages over the original Python version:
- Type Safety: Strong typing for all functions, parameters, and return values
- Developer Experience: Better IDE support with autocompletion and inline documentation
- Performance: Bun runtime provides excellent performance for JavaScript/TypeScript applications
Troubleshooting Tips
- Ensure the path to your MCP server repository is correct in the configuration.
- Verify that your Couchbase connection string, database username, password and bucket name are correct.
- If using Couchbase Capella, ensure that the cluster is accessible from the machine where the MCP server is running.
- Check that the database user has proper permissions to access the specified bucket.
- Confirm that Bun is properly installed and accessible.
- Check the logs for any errors or warnings that may indicate issues with the MCP server.
Support Policy
We truly appreciate your interest in this project! This project is community-maintained, which means it's not officially supported by a support team.
If you need help, have found a bug, or want to contribute improvements, the best place to do that is right here — by opening a GitHub issue. Our support portal is unable to assist with requests related to this project, so we kindly ask that all inquiries stay within GitHub.
Your collaboration helps us all move forward together — thank you!
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.