langflow/docs/docs/Integrations/mcp-component-astra.md
Mendon Kissling d4fca1fe40
docs: merge starter projects and sample flows into templates (#8652)
* move-pages-and-add-redirects

* move-vector-rag-in-list
2025-06-20 18:34:30 +00:00

2.8 KiB

title slug
Connect an Astra DB MCP server to Langflow /mcp-component-astra

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import Icon from "@site/src/components/icon";

Use the MCP connection component to connect Langflow to a Datastax Astra DB MCP server.

  1. Install an LTS release of Node.js.

  2. Create an OpenAI API key.

  3. Create an Astra DB Serverless (Vector) database, if you don't already have one.

  4. Get your database's Astra DB API endpoint and an Astra DB application token with the Database Administrator role. For more information, see Generate an application token for a database.

  5. Create a Simple agent starter project if you want to follow along with this guide. Otherwise, you can use an existing flow or create a new, blank flow.

  6. Remove the URL tool, and then replace it with an MCP connection component. The flow should look like this:

    MCP connection component connecting to Astra

  7. In the MCP connection component, in the MCP server field, add the following code to connect to an Astra DB MCP server:

    npx -y @datastax/astra-db-mcp
    
  8. In the MCP connection component, in the Env fields, add variables for ASTRA_DB_APPLICATION_TOKEN and ASTRA_DB_API_ENDPOINT with the values from your Astra database.

    :::important Langflow passes environment variables from the .env file to MCP, but not global variables declared in the UI. To add the values for ASTRA_DB_APPLICATION_TOKEN and ASTRA_DB_API_ENDPOINT as global variables, add them to Langflow's .env file at startup. For more information, see global variables. :::

    ASTRA_DB_APPLICATION_TOKEN=AstraCS:...
    
  9. To add another variable, click Add More.

    ASTRA_DB_API_ENDPOINT=https://...-us-east-2.apps.astra.datastax.com
    
  10. In the Agent component, add your OpenAI API key.

  11. Open the Playground, and then ask the agent, What collections are available?

    Since Langflow is connected to your Astra DB database through the MCP, the agent chooses the correct tool and connects to your database to retrieve the answer.

    The available collections in your database are:
    collection_002
    hardware_requirements
    load_collection
    nvidia_collection
    software_requirements