Create a Drizzle ORM Project Using the SingleStore MCP Server

You can easily create a Drizzle ORM project using the SingleStore MCP server and the VS Code MCP Client to connect to your SingleStore deployment and run queries.

Prerequisites

Ensure the following tools are installed:

  • Python 3.11+

  • uv

  • uvx

  • GitHub Copilot for VS Code

Connect to SingleStore using Drizzle ORM

The following example creates a Drizzle ORM project using the SingleStore MCP Server and the GitHub Copilot in VS Code MCP client, and performs the following tasks in response to a specified prompt:

  1. Initializes a npm project and installs the required dependencies.

  2. Creates the required configuration files (Typescript config, Drizzle config, etc.).

  3. Connects to a SingleStore deployment and runs the specified migration.

    1. Creates a table named stock in the SingleStore database.

    2. Inserts a sample data set into the stock table.

    3. Queries the table.

  4. Provides an overview of the steps performed.

The Copilot automates each of these steps, prompting the user only for a confirmation to proceed.

Step 1: Install the SingleStore MCP Server

Open an empty folder in VS Code and perform the following tasks:

  1. Run the following command in the terminal to initialize the SingleStore MCP Server in VS Code:

    uvx singlestore-mcp-server init
  2. Authenticate via browser OAuth (log in to the Cloud Portal).

Step 2: Add the SingleStore Drizzle ORM Context

After the changes are applied,

  1. Select Add context in the Copilot Chat view.

  2. From the list of resources, select MCP Resources.

    • (If required) Authenticate via browser OAuth. And, then select Add context > MCP Resources.

    • (If required) Start the SingleStore MCP server, select the icon in the chat view, and then select Start Server from the list.

  3. Select get_singlestore_drizzle_guide.

Step 3: Initialize the Project and Run the Application using Copilot

Upon adding the get_singlestore_drizzle_guide MCP context, enter the following prompt (or similar) in the Chat view:

Note

Update the connection configuration (connection string) of your SingleStore Helios deployment before submitting the prompt.

Create a sample Drizzle project using SingleStore.
The endpoint URL of the SingleStore deployment is:
singlestore://<username>:<password>@<endpoint>:<port>/<database>.
Create a table named stock, with the ID, Type, and quantity columns.
Insert sample data into the table and then query the data.
Also calculate the total stock of each Type.

After submitting the prompt, follow the instructions in the Chat view. The following example demonstrates the steps performed and the output generated by the Chat view in response to the specified prompt.

Note

The Copilot automates each of these steps, prompting the user only for a confirmation to proceed. (You may be prompted to select Continue after completing each step.)

  1. Initialize a new npm project.

    I'll help you create a Drizzle project with SingleStore integration.
    Let's break this down into steps:
    First, let's create a new workspace for the project:
    - Generating plan to create a new workspace
    Let me help you create a Drizzle project with SingleStore integration.
    I'll create the necessary files and set up the project structure.
    First, let's initialize a new npm project and install the required dependencies:
    Run command in terminal
    npm init -y
    Initializing a new npm project
  2. Install the required dependencies.

    Now, let's install the required dependencies:
    Run command in terrminal:
    npm install drizzle-orm mysql2 dotenv && npm install -D drizzle-kit typescript ts-node @types/node
    Installing required dependencies
  3. Generate the following necessary files:

    • tsconfig.json (TypeScript configuration)

    • schema.ts (database schema)

    • drizzle.config.ts (Drizzle configuration)

    • index.ts (database connection and queries)

    • .env (environment variables)

    • package.json (package scripts)

    Let's create the necessary TypeScript configuration:
    Created tsconfig.json
    Now, let's create our database schema:
    Created schema.ts
    Let's create the Drizzle configuration file:
    Created drizzle.config.ts
    Let's create our database connection and queries:
    Created index.ts
    Let's create the environment file with the SingleStore connection URL:
    Created .env
    Let's update the package.json scripts:
    Created package.json
  4. Run the migrations and start the application.

    Now, let's run the migrations and start the application.
    First, we'll generate and push the migrations:
    Run command in terminal
    npm run generate && npm run push
    Generating and pushing the database migrations
    Now let's run the application.
    npm run start
    
    Connecting to database...
    Creating stock table...
    Successfully connected to the database
    Inserting sample data...
    Querying all stocks:
    [
      { id: 4503599627370498, type: 'Furniture', quantity: 50 },
      { id: 4503599627370499, type: 'Electronics', quantity: 75 },
      { id: 4503599627370500, type: 'Clothing', quantity: 200 },
      { id: 4503599627370497, type: 'Electronics', quantity: 100 },
      { id: 4503599627370501, type: 'Furniture', quantity: 25 }
    ]
    Calculating total stock by type:
    [
      { type: 'Electronics', totalQuantity: '175' },
      { type: 'Clothing', totalQuantity: '200' },
      { type: 'Furniture', totalQuantity: '75' }
    ]
  5. Overview of the steps performed.

    Let's break down what we've accomplished:
    * Successfully connected to the SingleStore database
    * Created the stock table with the required columns:
    	* id (BIGINT, auto-incrementing primary key)
    	* type (VARCHAR)
    	* quantity (INT)
    * Successfully inserted sample data with different types of stock:
    	* Electronics (total: 175 units)
    	* Furniture (total: 75 units)
    	* Clothing (total: 200 units)
    * Successfully queried the data:
    	* Retrieved all stock entries
    	* Calculated total quantity by type using GROUP BY aggregation
    The application is now fully functional!

As instructed in the prompt, the Copilot successfully completes the specified tasks.

Last modified: August 13, 2025

Was this article helpful?

Verification instructions

Note: You must install cosign to verify the authenticity of the SingleStore file.

Use the following steps to verify the authenticity of singlestoredb-server, singlestoredb-toolbox, singlestoredb-studio, and singlestore-client SingleStore files that have been downloaded.

You may perform the following steps on any computer that can run cosign, such as the main deployment host of the cluster.

  1. (Optional) Run the following command to view the associated signature files.

    curl undefined
  2. Download the signature file from the SingleStore release server.

    • Option 1: Click the Download Signature button next to the SingleStore file.

    • Option 2: Copy and paste the following URL into the address bar of your browser and save the signature file.

    • Option 3: Run the following command to download the signature file.

      curl -O undefined
  3. After the signature file has been downloaded, run the following command to verify the authenticity of the SingleStore file.

    echo -n undefined |
    cosign verify-blob --certificate-oidc-issuer https://oidc.eks.us-east-1.amazonaws.com/id/CCDCDBA1379A5596AB5B2E46DCA385BC \
    --certificate-identity https://kubernetes.io/namespaces/freya-production/serviceaccounts/job-worker \
    --bundle undefined \
    --new-bundle-format -
    Verified OK