Build a Salesforce Lead Manager with Python and Code Assist MCP



Building code to connect different software systems used to be a slow and complex process. Developers had to invest significant time understanding how each system worked, reviewing documentation, and conducting thorough testing. Today, things have improved considerably. With AI coding assistants like Claude Code and straightforward integrations from CData Code Assist MCP and connectors, creating data-driven applications has become much faster and more accessible.

The following tutorial details the process for creating a Python GUI application that manages Salesforce Leads with full CRUD operations. Rapid development is possible by connecting CData Code Assist MCP for Salesforce with Claude Code and utilizing the CData Python Connector for Salesforce in the application.

Prerequisites

Before starting this tutorial, ensure the following components are installed and ready:

  • Python 3.x
  • CData Code Assist MCP for Salesforce
  • CData Python Connector for Salesforce with valid license
  • Claude Code

Configure CData Code Assist MCP

Proper setup of the Salesforce MCP connection is essential for efficient Claude Code development.

  1. Download and install the CData Code Assist MCP for Salesforce
  2. Launch CData Code Assist MCP for Salesforce to open the Configuration dialog
  3. Create a New Configuration
  4. Enter configuration name
  5. Configure Connection Properties:
    • Auth Scheme: Use Basic or OAuth as required
    • User: Enter your Salesforce username
    • Password: Enter your Salesforce account password
    • Security Token: Enter your Salesforce security token if required
    • Use Sandbox: Enable when connecting to a sandbox environment
    • Readonly: Set to false to enable write operations for full CRUD functionality.
  6. Click Save & Test to validate the connection.
  7. After the test connection is successful, click Next to navigate to the MCP Client Configuration page. From the dropdown, select Claude Code. The UI generates a configuration JSON and provides guidance on where to store the file. Click Copy JSON to obtain the configuration.
  8. Create a .mcp.json file in the project folder and paste the copied configuration.
  9. Create a file to store the Salesforce connection string for the Python Connector (e.g., python-salesforce-connection.md). This allows Claude Code to reference the credentials when generating the application.

Connecting with Claude Code

Claude Code automatically detects the .mcp.json file in the project directory. When pre-configured, Claude Code understands the MCP (design-time) and Python Connector (runtime) structure of the application without requiring explicit instructions to use MCP.

To verify the MCP connection is active, launch Claude Code in the project directory. The MCP server should be recognized automatically based on the .mcp.json configuration.

AI-Assisted Development with Claude Code

Start a new session in Claude Code and provide a prompt describing the application requirements:

"Create a Python GUI application that lists Leads from Salesforce. Add Insert, Update, Delete features."

Claude Code begins by reading the CData Code Assist MCP instructions and then performs schema discovery on the Salesforce Lead object. This process includes:

  • Finding the Lead table in Salesforce
  • Retrieving column information for the Lead table
  • Querying sample data to understand the schema
  • Fetching PickList values for fields like Lead Status, which vary between organizations

This schema discovery phase is a key benefit of using Code Assist MCP. Without it, Claude Code would need to guess table names and column structures, leading to potential errors at runtime.

After schema discovery, Claude Code generates the Python application code using the CData Python Connector for Salesforce. The generated application includes:

  • A Tkinter GUI with Treeview for displaying the lead list
  • Search functionality to filter leads by name, company, or email
  • Insert capability with form validation (LastName and Company required)
  • Update functionality to modify existing lead details
  • Delete feature with confirmation dialog
  • Status dropdown populated with actual PickList values from the Salesforce organization

Running the Application

Before running the application, ensure the following requirements are met:

  • Python 3.x installed
  • CData Python Connector for Salesforce installed
  • tkinter available (included with Python on Windows)
  • Connection string updated with valid Salesforce credentials

Update the connection string in the generated Python file with the appropriate Salesforce credentials, then run the application: python salesforce_lead_manager.py

The application launches with a GUI interface displaying Salesforce Leads in a sortable table. The Lead Details panel on the right allows viewing and editing individual lead information, while the action buttons enable Create, Update, and Delete operations.


Key Takeaways

The combination of AI coding tools with CData Code Assist MCP and CData Python Connector enables rapid development of data-driven applications. Key benefits include:

  • CData Code Assist MCP assists Python developers in coding data integration applications more efficiently through automated schema discovery
  • Claude Code understands the Code Assist MCP (design-time) and CData Python Connector (runtime) architecture from the MCP Instructions
  • CData Code Assist MCP provides even greater value when working with custom objects and complex queries
  • Because CData Code Assist MCP and CData connectors share the same data model for each source, the transition from development to production is seamless

Get Started Today

Start your 30-day free trial with CData Code Assist MCP and CData Python Connector to build integrations faster with AI-powered development.

Need assistance? Contact our support team.