Developer Guide: Code Assist MCP with Python

Build Python applications faster with AI-assisted development. This guide walks you through using CData Code Assist MCP with an AI coding tool like Cursor to generate production-ready Python code that connects to live data using CData Python Connectors.

Code Assist MCP provides schema-aware context to your AI coding assistant, enabling it to discover tables, columns, and data types from your actual data source. The AI generates accurate Python code that you can run in production using CData Python Connectors - no guessing, no hallucinated field names.

By the end of this guide, you'll have a working Python script that:

  • Connects to Google Sheets using the CData Python Connector
  • Queries customer data using standard DB-API patterns
  • Displays results in a formatted table

Architecture Overview

Code Assist MCP bridges AI-assisted development with production-ready data access:

┌─────────────────┐     ┌──────────────────┐     ┌─────────────────┐
│                 │     │                  │     │                 │
│  Cursor IDE     │────>│  Code Assist MCP │────>│  Google Sheets  │
│  (Development)  │     │  (Schema)        │     │  (Live Data)    │
│                 │<────│                  │<────│                 │
└─────────────────┘     └──────────────────┘     └─────────────────┘
        │
        │  Generated Python Code
        v
┌─────────────────┐     ┌──────────────────┐     ┌─────────────────┐
│                 │     │                  │     │                 │
│  Your Python    │────>│  CData Python    │────>│  Google Sheets  │
│  App            │     │  Connector       │     │  (Live Data)    │
│  (Production)   │<────│                  │<────│                 │
└─────────────────┘     └──────────────────┘     └─────────────────┘

How it works:

  1. Code Assist MCP connects to your data source and exposes schema information to Cursor
  2. Cursor's AI uses this context to generate accurate Python code with correct table and column names
  3. Your production application uses the CData Python Connector - same schema, same SQL syntax

Prerequisites

Before you begin, ensure the following are installed:


Step 1: Set Up Sample Data in Google Sheets

We'll use a sample Google Sheet containing sample CRM data to demonstrate the workflow.

  1. Navigate to the sample CRM spreadsheet
  2. Click File > Make a copy to save it to your Google Drive
  3. Give it a memorable name (e.g., "demo_organization") - you'll need this later

The spreadsheet contains four sheets:

  • account - Company information (Name, Industry, AnnualRevenue, NumberOfEmployees)
  • opportunity - Sales pipeline data (StageName, Amount, Probability, CloseDate)
  • tickets - Support cases (Subject, Priority, Status, CreatedAt)
  • usage - Product usage statistics (PRODUCT_GROUP, S_STANDARDJOBRUNS, S_RECORDSAFFECTED)

Step 2: Install and Configure Code Assist MCP

  1. Download and install the CData Code Assist MCP for Google Sheets
  2. Launch the Code Assist MCP configuration wizard after installation
  3. Create a new configuration and name it (e.g., "cdata-googlesheets")
  4. Configure your Google Sheets connection:
    • Click Connect to authenticate with Google via OAuth
    • After authentication, enter your spreadsheet name in the Spreadsheet field (e.g., "demo_organization")
    Google Sheets MCP connection configuration showing OAuth and Spreadsheet fields
  5. Click Save & Test to validate the connection Connection successful message with Next button highlighted

Step 3: Configure Cursor to Use Code Assist MCP

  1. After saving your connection, click Next in the configuration wizard
  2. Select Cursor from the AI MCP Tool dropdown AI MCP Tool dropdown with Cursor selected
  3. Follow the instructions to create the MCP configuration:
    • Create a .cursor folder in your project directory
    • Create a file named mcp.json inside the .cursor folder
    MCP Client Instructions showing file paths and Copy JSON button
  4. Click Copy JSON and paste the configuration into your mcp.json file
  5. Restart Cursor to load the new MCP configuration

Verify the MCP Connection

  1. In Cursor, press Ctrl+Shift+P (or Cmd+Shift+P on macOS) to open the Command Palette
  2. Type View: Open MCP Settings and select it
  3. Navigate to Tools & MCP in the settings Cursor Settings showing Tools & MCP in the sidebar
  4. Confirm your Code Assist MCP connection (e.g., "cdata-googlesheets") appears as Running under Installed MCP Servers Cursor MCP settings showing cdata-googlesheets connection as Running

Step 4: Install the CData Python Connector

The Python Connector will be used at runtime by your generated application.

  1. Download the CData Python Connector for Google Sheets and extract the ZIP file
  2. Open a terminal and navigate to the extracted directory containing the installer file. For example: cd C:\Users\Public\Downloads\GoogleSheetsPythonConnector\CData.Python.GoogleSheets\win\Python312\64
  3. Install the connector using pip:
    • Windows: Install the .whl file for your Python version: pip install cdata_googlesheets_connector-24.0.9111-cp312-cp312-win_amd64.whl
    • macOS/Linux: Install the .tar.gz file: pip install cdata_googlesheets_connector-24.0.####-python3.tar.gz
  4. Verify the installation: pip list | grep cdata

    If cdata-googlesheets-connector is listed, the installation was successful.

  5. Install the license by running the license installer included in the package:
    • Windows: Navigate to the license installer directory (e.g., Lib\site-packages\cdata\installlic_googlesheets) and run: .\license-installer.exe
    • macOS/Linux: Navigate to the license installer directory and run: ./license-installer

    Enter your license key when prompted (or use TRIAL for a 30-day evaluation).

Step 5: Build the Application with Cursor

  1. Create a new folder for your project and open it in Cursor
  2. Open Cursor's AI chat pane (click the chat icon or use the Toggle AI Pane command)
  3. First, ask Cursor to review the MCP connection instructions:
    Review the instructions for my cdata-googlesheets connection
    Cursor AI chat showing review of MCP connection instructions
  4. Once Cursor confirms it has the context, prompt it to build the application:
    Build a Python script that connects to Google Sheets using the CData Python Connector. Query the "account" sheet and display all accounts with their Name, Industry, and AnnualRevenue in a formatted table. Use the schema from my cdata-googlesheets MCP connection. Store the connection string in an environment variable for security.
  5. Cursor will generate:
    • Python code using proper DB-API patterns (connect, cursor, execute, fetchall)
    • Correct table and column names based on the actual Google Sheets schema
    • Environment variable handling for the connection string
    Cursor generating Python code with CData Python Connector

Step 6: Configure and Run the Application

  1. Set your connection string as an environment variable: set GOOGLESHEETS_CONN="Spreadsheet=demo_organization;InitiateOAuth=GETANDREFRESH;"

    On macOS/Linux, use export instead of set

  2. Run the Python script: python googlesheets_app.py
  3. The application will authenticate with Google (if needed) and display your account data

Example Output

Name                        Industry            AnnualRevenue
------------------------------------------------------------
Acme Corporation            Technology          2500000
Global Industries           Manufacturing       15000000
StartupCo                   Software            500000
Enterprise Inc              Finance             50000000

What's Next?

You've built a working Python application using AI-assisted development. The same pattern works for any of the hundreds of data sources supported by CData Python Connectors.

Try these next steps:

  • Add CRUD operations (Create, Update, Delete) to your script
  • Query multiple sheets and join data
  • Build a data pipeline using Pandas or SQLAlchemy
  • Connect to a different data source like Salesforce or Jira

Troubleshooting

If you encounter issues, try these common solutions:

  • MCP not showing as "Running" in Cursor - Verify the mcp.json file is in the correct location (.cursor folder in your project root). Restart Cursor after adding or modifying the configuration.
  • OAuth authentication fails - Ensure pop-ups are enabled in your browser. Try clearing your browser cache or using a private/incognito window for the OAuth flow.
  • ModuleNotFoundError for cdata connector - Verify the CData Python Connector is installed in your active Python environment. Run pip list | grep cdata to check. Ensure you installed the correct .whl or .tar.gz file for your Python version and platform.
  • Connection string errors - Verify the spreadsheet name in your connection string matches exactly (case-sensitive) and that you have access to the spreadsheet in Google Drive.
  • AI generates incorrect column names - Ask Cursor to review the MCP connection instructions again before generating code. This refreshes the schema context.

Python Development with CData

CData Code Assist MCP and CData Python Connectors share the same data model, so the SQL you validate during development works identically in production. This eliminates the disconnect between AI-generated code and real-world data access.

Code Assist MCP works with any AI model supported by your coding tool - it's model agnostic. Whether you're using GPT-4, Claude, or another model in Cursor, the MCP provides the same accurate schema context.

Ready to accelerate your Python development? Download Code Assist MCP for Google Sheets for free and get a free trial of the CData Python Connector for Google Sheets to get started.