# 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

* Python 3.11+
* [uv](https://docs.astral.sh/uv/getting-started/installation/)
* [uvx](https://docs.astral.sh/uv/guides/tools/)
* 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:
   ```shell
   uvx singlestore-mcp-server init
   ```

2. Authenticate via browser OAuth (log in to the [Cloud Portal](https://portal.singlestore.com)).

3. Restart the MCP client (VS Code) to apply the changes.

## 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.

```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.
   ```Response
   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.
   ```Response
   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)
   ```Response
   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.
   ```Response
   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

   ```
   ```output
    
   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.
   ```Response
   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.

## Related Topics

* [Connect with Drizzle ORM](https://docs.singlestore.com/cloud/developer-resources/connect-with-application-development-tools/connect-with-node-js/connect-with-drizzle-orm.md)

***

Modified at: September 22, 2025

Source: [/cloud/ai/singlestore-mcp-server/create-a-drizzle-orm-project-using-the-singlestore-mcp-server/](https://docs.singlestore.com/cloud/ai/singlestore-mcp-server/create-a-drizzle-orm-project-using-the-singlestore-mcp-server/)

(An index of the documentation is available at /llms.txt)
