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:
- Code Assist MCP connects to your data source and exposes schema information to Cursor
- Cursor's AI uses this context to generate accurate Python code with correct table and column names
- Your production application uses the CData Python Connector - same schema, same SQL syntax
Prerequisites
Before you begin, ensure the following are installed:
- Python 3.8 or later - Download from Python.org
- Cursor IDE - Download Cursor (or another AI coding tool with MCP support)
- CData Code Assist MCP for Google Sheets - Download
- CData Python Connector for Google Sheets - Download
- A Google account for accessing Google Sheets
Step 1: Set Up Sample Data in Google Sheets
We'll use a sample Google Sheet containing sample CRM data to demonstrate the workflow.
- Navigate to the sample CRM spreadsheet
- Click File > Make a copy to save it to your Google Drive
- 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
- Download and install the CData Code Assist MCP for Google Sheets
- Launch the Code Assist MCP configuration wizard after installation
- Create a new configuration and name it (e.g., "cdata-googlesheets")
- 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")
- Click Save & Test to validate the connection
Step 3: Configure Cursor to Use Code Assist MCP
- After saving your connection, click Next in the configuration wizard
- Select Cursor from the AI MCP Tool dropdown
- 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
- Click Copy JSON and paste the configuration into your mcp.json file
- Restart Cursor to load the new MCP configuration
Verify the MCP Connection
- In Cursor, press Ctrl+Shift+P (or Cmd+Shift+P on macOS) to open the Command Palette
- Type View: Open MCP Settings and select it
- Navigate to Tools & MCP in the settings
- Confirm your Code Assist MCP connection (e.g., "cdata-googlesheets") appears as Running under Installed MCP Servers
Step 4: Install the CData Python Connector
The Python Connector will be used at runtime by your generated application.
- Download the CData Python Connector for Google Sheets and extract the ZIP file
- 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 - 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
- Windows: Install the .whl file for your Python version:
- Verify the installation:
pip list | grep cdataIf cdata-googlesheets-connector is listed, the installation was successful.
- 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).
- Windows: Navigate to the license installer directory (e.g., Lib\site-packages\cdata\installlic_googlesheets) and run:
Step 5: Build the Application with Cursor
- Create a new folder for your project and open it in Cursor
- Open Cursor's AI chat pane (click the chat icon or use the Toggle AI Pane command)
- First, ask Cursor to review the MCP connection instructions:
Review the instructions for my cdata-googlesheets connection
- 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.
- 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
Step 6: Configure and Run the Application
- Set your connection string as an environment variable:
set GOOGLESHEETS_CONN="Spreadsheet=demo_organization;InitiateOAuth=GETANDREFRESH;"On macOS/Linux, use export instead of set
- Run the Python script:
python googlesheets_app.py - 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.