VOOZH about

URL: https://www.cdata.com/kb/tech/cosmosdb-mcp-gemini-code-assist.rst

⇱ Build Cosmos DB-Powered Applications in Gemini Code Assist with CData Code Assist MCP


Build Cosmos DB-Powered Applications in Gemini Code Assist with CData Code Assist MCP

πŸ‘ Somya Sharma
Somya Sharma
Technical Marketing Engineer
Use the CData Code Assist MCP for Cosmos DB to explore live Cosmos DB Data in Gemini Code Assist to assist with building Cosmos DB-powered applications.

Gemini Code Assist is an AI-powered coding companion that integrates intelligent code generation into everyday development workflows. With support for MCP, Gemini Code Assist can connect to live enterprise data sources directly from Visual Studio Code, enabling natural language interaction with structured data without switching context or manually writing data access code.

Model Context Protocol (MCP) is an open standard for connecting LLM clients to external services through structured tool interfaces. MCP servers expose capabilities such as schema discovery and live querying, allowing AI agents to retrieve and reason over real-time data safely and consistently.

This guide explains how to install the CData Code Assist MCP for Cosmos DB, configure the connection to Cosmos DB, connect the Code Assist MCP add-on to Gemini Code Assist, and query live Cosmos DB data from within the editor.

Prerequisites

Before starting, ensure the following requirements are met:

  1. Visual Studio Code is installed on the machine
  2. Gemini Code Assist extension is enabled in Visual Studio Code
  3. CData Code Assist MCP for Cosmos DB has been installed
  4. Access to Cosmos DB

Note: Gemini Code Assist must already be set up and functional in Visual Studio Code before configuring MCP servers. MCP servers are accessed when Gemini Code Assist is running in Agent mode.

Step 1: Download and install the CData Code Assist MCP for Cosmos DB

  1. To begin, download the CData Code Assist MCP for Cosmos DB πŸ‘ Downloading the CData Code Assist MCP add-on installer
  2. Find and double-click the installer to begin the installation
  3. Run the installer and follow the prompts to complete the installation πŸ‘ Completing the CData Code Assist MCP add-on installation

When the installation is complete, the Code Assist MCP add-on is ready for configuration by connecting to Cosmos DB.

Step 2: Configure the connection to Cosmos DB

  1. After installation, open the CData Code Assist MCP for Cosmos DB configuration wizard πŸ‘ The CData Code Assist MCP add-on configuration wizard

    NOTE: If the wizard does not open automatically, search for "CData Code Assist MCP for Cosmos DB" in the Windows search bar and open the application.

    πŸ‘ Opening the CData Code Assist MCP add-on configuration wizard
  2. In MCP Configuration > Configuration Name, either select an existing configuration or choose to create a new one πŸ‘ Creating a new configuration
  3. Name the configuration (e.g. "cdata_cosmosdb") and click OK πŸ‘ Naming the configuration
  4. Enter the appropriate connection properties in the configuration wizard

    To obtain the connection string needed to connect to a Cosmos DB account using the SQL API, log in to the Azure Portal, select Azure Cosmos DB, and select your account. In the Settings section, click Connection String and set the following values:

    • AccountEndpoint: The Cosmos DB account URL from the Keys blade of the Cosmos DB account
    • AccountKey: In the Azure portal, navigate to the Cosmos DB service and select your Azure Cosmos DB account. From the resource menu, go to the Keys page. Find the PRIMARY KEY value and set AccountKey to this value.
    πŸ‘ Configuring the Code Assist MCP add-on connection
  5. Click Connect to authenticate with Cosmos DB
  6. Then, click Save Configuration to save the Code Assist MCP add-on πŸ‘ Saving the Code Assist MCP add-on configuration

This process creates a .mcp configuration file that Gemini Code Assist will reference when launching the Code Assist MCP add-on. With the Code Assist MCP add-on configured, it is ready to connect to Gemini Code Assist.

Step 3: Connect the Code Assist MCP add-on to Gemini Code Assist

  1. Ensure Visual Studio Code is installed and the Gemini Code Assist extension is enabled
  2. From the configuration wizard, click Next after saving and testing the connection πŸ‘ Selecting 'Next'
  3. Select Gemini Code Assist from the AI MCP Tool dropdown πŸ‘ Choosing Gemini Code Assist as the AI MCP tool
  4. Click Copy JSON to copy the generated MCP configuration to the clipboard πŸ‘ Copying the MCP configuration
  5. Paste the copied JSON into the appropriate configuration file based on the desired scope:
    • User-level: Configuration applies across all projects for the current user
    • Workspace-level: Configuration applies only to the current workspace or project

    NOTE: The configuration includes the path to Java 17+ executable and the CData Code Assist MCP add-on JAR file. The final argument must match the MCP configuration name saved in the wizard (e.g. "cdata_cosmosdb").

  6. Save the configuration file and restart Visual Studio Code if necessary

Step 4: Query live Cosmos DB data in Gemini Code Assist

  1. Open Visual Studio Code and select Gemini Code Assist in the activity bar πŸ‘ Open Gemini Code Assist
  2. Enter /mcp in the chat prompt to verify the connection status. The Cosmos DB Code Assist MCP add-on should appear with a green connection indicator πŸ‘ Verify the connection status
  3. Ask questions about Cosmos DB data using natural language. For example:
    "Provide the list of all tables available in my Cosmos DB data connection."
    πŸ‘ Querying live data from Gemini Code Assist
  4. Generate code that works with live Cosmos DB data. For example:
    "Write a function to retrieve records from the Customers table where City matches a given value."
    πŸ‘ Generating function for live data from Gemini Code Assist

Gemini Code Assist is now fully integrated with the CData Code Assist MCP add-on and can use the MCP tools exposed to explore schemas, execute live queries against Cosmos DB, and generate data-aware code.

Build with Code Assist MCP. Deploy with CData Drivers.

Download Code Assist MCP for free and give your AI tools schema-aware access to live Cosmos DB data during development. When you're ready to move to production, CData Cosmos DB Drivers deliver the same SQL-based access with enterprise-grade performance, security, and reliability.

Visit the CData Community to share insights, ask questions, and explore what's possible with MCP-powered AI workflows.

Ready to get started?

Download a free Cosmos DB Code Assist MCP to get started:

 Download Now

Learn more:

πŸ‘ Cosmos DB Icon
Cosmos DB Code Assist MCP

The CData Code Assist MCP for Cosmos DB provides schema-aware context for AI-assisted code generation with live Cosmos DB data.