home / mcp / astra db mcp server
An MCP server for Astra DB workloads
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.
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.
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.
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 commandsThe 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.
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.
Retrieve all collections in the connected Astra DB database.
Create a new collection with vector support to enable vector search.
Update properties of an existing collection.
Delete a collection from the database.
Estimate the number of documents in a collection.
List records from a specific collection.
Fetch a single record by its ID.
Create a new record in a collection.
Update an existing record in a collection.
Delete a record from a collection.
Find records in a collection by a field value.
Find distinct values for a specific field in a collection.
Create multiple records in a collection in a single operation.
Update multiple records in a single operation.
Delete multiple records from a collection in a single operation.
Perform vector similarity search on vector embeddings.
Combine vector similarity search with text search for richer results.
Open a web browser for authentication and setup.
Get assistance with adding Astra DB client to your MCP client.