home / mcp / astra db mcp server

Astra DB MCP Server

An MCP server for Astra DB workloads

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "datastax-astra-db-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@datastax/astra-db-mcp"
      ],
      "env": {
        "ASTRA_DB_KEYSPACE": "your_desired_keyspace",
        "ASTRA_DB_API_ENDPOINT": "your_astra_db_endpoint",
        "ASTRA_DB_APPLICATION_TOKEN": "your_astra_db_token"
      }
    }
  }
}

You can use the Astra DB MCP Server to interact with your Astra DB data from your language models or automation tools. This MCP server exposes a rich set of operations for managing collections, records, and vector search, enabling your AI workflows to read, write, and search Astra DB data directly through MCP clients.

How to use

You connect an MCP client to the Astra DB MCP Server and authenticate with your Astra DB credentials. Once connected, you can manage collections, perform CRUD operations on records, run bulk operations, and leverage vector search capabilities to find similar items. Use the server to create and configure collections with vector support, insert and query records, and perform hybrid searches that combine vector similarity with text relevance. For vector-based AI tasks, prepare your embeddings and then call the VectorSearch or HybridSearch tools to retrieve relevant items from your Astra DB data.

How to install

Prerequisites: You need a running Node.js environment with npm or yarn installed. Ensure you have access to an Astra DB database and have obtained an Astra DB Application Token and the Astra DB API Endpoint.

Step 1: Install Node.js and npm if they are not already installed. You can verify with the following commands:

Step 2: Prepare your environment variables. You will need your Astra DB Application Token and API Endpoint. Set them in your shell for the session or export them in a script.

Step 3: Start the MCP server using the standard MCP runtime command. The recommended usage is to run the MCP server with npx and pass the Astra DB MCP package.

Configuration and usage notes

Environment variables you may use with the Astra DB MCP Server: - ASTRA_DB_APPLICATION_TOKEN: Your Astra DB application token for authentication. - ASTRA_DB_API_ENDPOINT: The Astra DB API endpoint to connect to. - ASTRA_DB_KEYSPACE: Optional. Specify the keyspace to connect to if you do not want to use the default keyspace configured by the library.

Example usage with a shell session:
- Set the environment variables for the session
- Run the MCP server via npx to start listening for MCP client commands

New features and capabilities you can rely on

The server includes robust vector search capabilities, including VectorSearch for vector similarity, HybridSearch to combine vector and text search, and enhanced error handling to help diagnose issues quickly.

Security and access considerations

Protect your Astra DB Application Token and API Endpoint. Use least-privilege tokens and rotate credentials regularly. Do not commit tokens to source control. When running in shared environments, consider scoped tokens and per-project configurations.

Available tools

GetCollections

Retrieve all collections in the connected Astra DB database.

CreateCollection

Create a new collection with vector support to enable vector search.

UpdateCollection

Update properties of an existing collection.

DeleteCollection

Delete a collection from the database.

EstimateDocumentCount

Estimate the number of documents in a collection.

ListRecords

List records from a specific collection.

GetRecord

Fetch a single record by its ID.

CreateRecord

Create a new record in a collection.

UpdateRecord

Update an existing record in a collection.

DeleteRecord

Delete a record from a collection.

FindRecord

Find records in a collection by a field value.

FindDistinctValues

Find distinct values for a specific field in a collection.

BulkCreateRecords

Create multiple records in a collection in a single operation.

BulkUpdateRecords

Update multiple records in a single operation.

BulkDeleteRecords

Delete multiple records from a collection in a single operation.

VectorSearch

Perform vector similarity search on vector embeddings.

HybridSearch

Combine vector similarity search with text search for richer results.

OpenBrowser

Open a web browser for authentication and setup.

HelpAddToClient

Get assistance with adding Astra DB client to your MCP client.