Using Gemini CLI in VS Code and Configuring the MCP Server Explained in 5 Minutes
This article provides a comprehensive guide on how to use and install the Gemini CLI within VS Code and how to configure the MCP server for advanced integrations. For a more detailed installation guide, please refer to our previous publication on the topic.
Quick Installation Guide
For those new to the Gemini CLI, here is a brief overview of the installation process:
- Prerequisites: Ensure you have Node.js installed on your system.
- Find the Repository: Search for "Gemini CLI" and navigate to the official GitHub repository.
Install the CLI: Copy the installation command provided in the repository.
npm install -g @google/generative-ai-cli
Run the Command: Open your terminal (or Command Prompt on Windows), paste the command, and press Enter. Within a few moments, the CLI will be installed.
Initial Configuration
For first-time users, the CLI will prompt you for an initial setup:
- Theme Selection: You will first be asked to select a theme for the CLI interface.
- Login: You have several options to log in:
- Login with Google (recommended for free use)
- API Key
- Vertex AI (for paid tiers)
To log in with your Google account, the process will redirect you to a browser window where you can sign in with your Gmail credentials. Once authenticated, you can return to your command line. The CLI is now configured and ready to use. You can test it by typing gemini hi
, and it should respond accordingly.
From here, you can run various commands, give prompts, and even generate applications or landing pages.
Integrating Gemini CLI with VS Code
To use the Gemini CLI directly within VS Code, follow these simple steps:
- Open a Project Folder: Launch VS Code and open an empty project folder. For this demonstration, we've created a folder named
gemini-demo
. - Open the Terminal: Navigate to the terminal within VS Code by selecting
Terminal > New Terminal
. - Run the Installation Command: Paste the same installation command you used earlier into the VS Code terminal and run it.
The Gemini CLI will now be operational inside VS Code. If you have already logged in via your system's command line, it will not ask for login credentials again.
Configuring the MCP Server with Blender
Now, let's configure an MCP (Model Control Program) server. This allows Gemini to interact with other applications. In this guide, we will use Blender, a free and open-source 3D computer graphics software toolset.
Step 1: Update Gemini Settings
First, you need to edit the Gemini settings file.
- If the Gemini CLI is configured, it creates a hidden
.gemini
folder in your user directory. Navigate to it using the command line:bash cd ~/.gemini
- Open this folder in VS Code to easily edit the
settings.json
file.
Step 2: Add Blender MCP Configuration
- Search for the "Blender MCP" GitHub repository.
- In the repository, scroll down to find the configuration code block.
- Copy this code and paste it into your
settings.json
file, then save it.
After saving, return to your terminal and run the command /mcp
. You should now see Blender listed as an available MCP.
Step 3: Install Prerequisites
The Blender MCP has a few prerequisites that need to be installed.
- Install Brew: If you don't have it, install Brew by copying the installation command from their official site and running it in your terminal.
- Set the Path:
- For Windows, use the appropriate path command provided in the repository.
- For macOS, use the following command:
bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Verify Installation: Check if the installation was successful by running a command like
uv --version
. If it returns a version number, you are good to go.
Step 4: Configure Blender
- Install Blender: Download and install the latest version of Blender from its official website.
- Install the Add-on:
- In the Blender MCP GitHub repository, find and download the
addon.py
file. - Open Blender and go to
Edit > Preferences > Add-ons
. - Click Install... and select the
addon.py
file you just downloaded.
- In the Blender MCP GitHub repository, find and download the
- Connect to the MCP Server:
- After the add-on is installed, press the
N
key in Blender's main view to open the sidebar. - You will see a new Blender MCP panel.
- Check the first option: Use assets from Polyhaven.
- The other options require a paid API key, so leave them unchecked for free use.
- Click Connect to MCP Server.
- After the add-on is installed, press the
Generating 3D Models with a Prompt
Your setup is now complete. You can generate 3D models directly from a prompt in your terminal.
- Return to your terminal (in VS Code or standalone).
- Type a prompt to generate a model. For example:
/mcp blender create me more than 8+ trees
- The CLI will ask for permission to allow the operation. Grant it.
- After a few moments, you will receive a confirmation message.
Now, switch to Blender, and you will see that the trees have been created in your scene. While the quality from the free-tier generation might be basic, it demonstrates the powerful capability of integrating Gemini CLI with other tools. Using a paid API key will yield significantly better results.
This walkthrough has shown how to effectively use the Gemini CLI in VS Code and configure an MCP server to extend its functionality into applications like Blender.
Join the 10xdev Community
Subscribe and get 8+ free PDFs that contain detailed roadmaps with recommended learning periods for each programming language or field, along with links to free resources such as books, YouTube tutorials, and courses with certificates.