Thanks to visit codestin.com
Credit goes to github.com

Skip to content

CDataSoftware/cdata-mcp-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cdata-python-mcp-server

A generic Model Context Protocol (MCP) Server for CData Python Connectors.

Quick Start (Experienced Users)

# Clone and setup
git clone https://github.com/CDataSoftware/cdata-mcp-python.git
cd cdata-mcp-python
uv venv && uv pip install "mcp[cli]"

# Install your connector (from the project directory!)
uv pip install ./your-cdata-connector.whl

# Verify installation
uv pip list | grep cdata

# Test connection
export CONNECTOR_MOD="cdata.{datasource}"
export CONNECTION_STRING="InitiateOAuth=GETANDREFRESH;"  # Or your auth method
uv run python -c "from utils.get_connection import get_connection; print('✅ Connected!' if get_connection() else '❌ Failed')"

# Configure Claude Desktop (add to claude_desktop_config.json)
# Then restart Claude completely

Purpose

We created this MCP Server to allow LLMs (like Claude) to query live data from any of over 250+ sources (listed below) supported by CData Python Connectors (free Community Licenses for personal use).

CData Python Connectors connect to SaaS apps, NoSQL stores, and APIs by exposing them as relational SQL models.

This server wraps those connectors and makes their data available through a simple MCP interface, so LLMs can retrieve live information by asking natural language questions — no SQL required.

Prerequisites

System Requirements

  • Python: 3.12 or higher
  • Operating System: Windows, macOS, or Linux
  • Package Manager: uv (for Python dependency management)

Required Components

  1. UV Package Manager

    Install with pip:

    pip install uv
  2. CData Python Connector

    You'll need a CData Python Connector for your specific data source. The connector name format is cdata.{datasource} (e.g., cdata.salesforce, cdata.jira, cdata.mongodb).

  3. Connection Configuration

    Prepare your connection string with authentication details for your data source. Each connector has different requirements.

    Common Connection String Examples
    • Salesforce:

      # Full OAuth with domain
      InitiateOAuth=GETANDREFRESH;LoginURL=domain.my.salesforce.com;
      
      # Simplified OAuth (often works without LoginURL)
      InitiateOAuth=GETANDREFRESH;
      
      # Username/Password
      [email protected];Password=yourpass;SecurityToken=token;LoginURL=domain.my.salesforce.com;
      
    • MongoDB:

      Server=localhost;Port=27017;Database=mydb;User=myuser;Password=mypass;
      
    • MySQL:

      Server=myserver.com;Port=3306;Database=mydb;UID=myuser;PWD=mypass;
      
    • REST API:

      Format=JSON;URI=https://api.example.com/data;AuthScheme=OAuth;
      

    Find your connector's specific requirements at: https://cdn.cdata.com/help/{datasource}/pg_connectionprops.htm

Setup Guide

Step 1: Clone the Repository

git clone https://github.com/CDataSoftware/cdata-mcp-python.git
cd cdata-mcp-python

Step 2: Set Up Python Environment

  1. Create the virtual environment:

    uv venv

    Note: With uv, you typically don't need to manually activate the virtual environment. The uv pip and uv run commands automatically use the .venv in the current directory.

  2. Install MCP dependencies:

    uv pip install "mcp[cli]"
  3. Verify the virtual environment is being used:

    uv pip list  # Should show it's using .venv in the current directory

Step 3: Install Your CData Connector

Install the CData Python Connector you downloaded earlier:

Windows:

uv pip install "C:\path\to\cdata_{datasource}_connector-23.0.xxxx-cp312-cp312-win_amd64.whl"

macOS/Linux:

uv pip install /path/to/cdata-{datasource}-connector-23.0.xxxx-py3-none-any.whl

Example for Salesforce:

uv pip install ./cdata_salesforce_connector-23.0.8691-py3-none-any.whl

Important: Always run uv pip commands from the project directory to ensure packages are installed in the correct virtual environment. You can verify the installation with:

uv pip list | grep cdata

Step 4: Activate Your Connector License

Note: Some connectors may work without explicit license activation during initial testing. If you encounter license errors, follow the activation steps below.

License Activation Instructions

Locate and run the license installer for your connector:

  1. Find the installer location using this Python script:

    import os
    import cdata.{datasource}  # Replace {datasource} with your connector name
    path = os.path.dirname(os.path.abspath(cdata.{datasource}.__file__))
    print(f"License installer location: {path}/installlic_{datasource}/")
  2. Navigate to the installer directory and activate:

    Windows:

    cd .venv\Lib\site-packages\cdata\installlic_{datasource}
    .\install-license.exe  # For trial license
    # OR
    .\install-license.exe YOUR-LICENSE-KEY  # For paid license

    macOS/Linux:

    cd .venv/lib/python3.12/site-packages/cdata/installlic_{datasource}
    ./install-license.sh  # For trial license
    # OR
    ./install-license.sh YOUR-LICENSE-KEY  # For paid license

Testing Your Setup

Testing Instructions

Step 1: Test Your Connector Installation

Before configuring Claude Desktop, verify your connector works correctly:

# test_connector.py
import os
os.environ['CONNECTOR_MOD'] = 'cdata.{datasource}'  # Replace with your connector
os.environ['CONNECTION_STRING'] = 'Your=Connection;String=Here;'

try:
    from utils.get_connection import get_connection
    conn = get_connection()
    cursor = conn.cursor()
    cursor.execute("SELECT * FROM sys_tables")
    tables = cursor.fetchall()
    print(f"Successfully connected! Found {len(tables)} tables.")
    for table in tables[:5]:  # Show first 5 tables
        print(f"  - {table[0]}")
    cursor.close()
    conn.close()
except Exception as e:
    print(f"Connection failed: {e}")

Run the test:

python test_connector.py

Step 2: Test the MCP Server

Run the server directly to ensure it starts without errors:

export CONNECTOR_MOD="cdata.{datasource}"  # Windows: set CONNECTOR_MOD=cdata.{datasource}
export CONNECTION_STRING="Your=Connection;String=Here;"  # Windows: set CONNECTION_STRING=...
uv run --active main.py

You should see:

Starting server

Press Ctrl+C to stop the server.

Using the Server with Claude Desktop

Step 1: Configure Claude Desktop

Create or edit the Claude Desktop configuration file:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

Add your MCP server configuration:

{
    "mcpServers": {
        "salesforce_server": {
            "command": "uv",
            "args": [
                "--directory",
                "/absolute/path/to/cdata-mcp-python",
                "run",
                "--active",
                "main.py"
            ],
            "env": {
                "CONNECTOR_MOD": "cdata.salesforce",
                "CONNECTION_STRING": "InitiateOAuth=GETANDREFRESH;LoginURL=mycompany.my.salesforce.com;"
            }
        }
    }
}

Important Notes:

  • Replace salesforce_server with a descriptive name for your data source
  • Use the absolute path to your cloned repository directory
  • Replace cdata.salesforce with your actual connector module name
  • Use your actual connection string (keep it secure!)

Step 2: Restart Claude Desktop

  1. Fully quit Claude Desktop (not just close the window):

    • Windows: Right-click system tray icon → Quit
    • macOS: Claude → Quit Claude (Cmd+Q)
    • Linux: Close and ensure process is terminated
  2. Reopen Claude Desktop

  3. Verify the server appears in the MCP servers list (look for the server icon)

Step 3: Test with Claude

Ask Claude questions about your data:

  • "What tables are available in my Salesforce instance?"
  • "Show me the first 5 records from the Account table"
  • "What fields are in the Contact table?"

Usage Details

Once the MCP Server is configured, the AI client will be able to use the built-in tools to read, write, update, and delete the underlying data. In general, you do not need to call the tools explicitly. Simply ask the client to answer questions about the underlying data system. For example:

  • "What is the correlation between my closed won opportunities and the account industry?"
  • "How many open tickets do I have in the SUPPORT project?"
  • "Can you tell me what calendar events I have today?"

The list of tools available and their descriptions follow:

Available Tools

The MCP server provides these tools to Claude for interacting with your data:

Tool Description Example Use
get_tables Lists all available tables/views "What tables are available?"
get_columns Shows fields for a specific table "What fields are in the Account table?"
get_procedures Lists available stored procedures "What actions can I perform?"
get_procedure_params Shows parameters for a procedure "What parameters does CreateInvoice need?"
run_query Executes SELECT queries "Show me all contacts from California"
run_nonquery Executes INSERT/UPDATE/DELETE "Update the phone number for contact ID 123"
call_procedure Calls stored procedures "Execute the RefreshToken procedure"

Troubleshooting

Common Issues and Solutions

MCP Server Not Appearing in Claude Desktop

Problem: The server doesn't show up in Claude's MCP servers list.

Solutions:

  1. Fully quit Claude Desktop (not just minimize):

    • Windows: Check Task Manager and end all Claude processes
    • macOS: Use Activity Monitor to ensure Claude is not running
    • Linux: Use ps aux | grep -i claude to check for running processes
  2. Verify configuration file:

    # Check if config file exists and is valid JSON
    cat ~/Library/Application\ Support/Claude/claude_desktop_config.json | python -m json.tool
  3. Check for syntax errors in your configuration (missing commas, quotes, etc.)

Connection Errors

Problem: "Connection failed" or authentication errors.

Solutions:

  1. Test connection string using the test script provided in the Testing section
  2. Verify credentials and authentication method for your data source
  3. Check network access to your data source (VPN, firewall, etc.)
  4. OAuth connections: Ensure redirect URLs are properly configured

License Activation Issues

Problem: "License not found" or "Invalid license" errors.

Solutions:

  1. Verify license installation:

    import cdata.{datasource}
    print(cdata.{datasource}.__version__)  # Should show version if properly licensed
  2. Re-run license installer with correct permissions (may need sudo on Linux/Mac)

  3. Check license expiration for trial licenses (30 days)

Module Import Errors

Problem: "ModuleNotFoundError: No module named 'cdata.{datasource}'"

Solutions:

  1. Ensure virtual environment is activated:

    which python  # Should show .venv/bin/python path
  2. Reinstall connector in the virtual environment:

    uv pip install --force-reinstall /path/to/connector.whl
  3. Verify CONNECTOR_MOD environment variable matches installed module name

Performance Issues

Problem: Queries are slow or timing out.

Solutions:

  1. Limit query results:

    SELECT TOP 100 * FROM TableName  -- SQL Server syntax
    SELECT * FROM TableName LIMIT 100  -- MySQL/PostgreSQL syntax
  2. Add query filters to reduce data transfer

  3. Check data source performance directly

  4. Increase timeout values in connection string if supported

Debug Mode

Enable verbose logging to diagnose issues:

  1. Create a debug wrapper script:

    # debug_server.py
    import os
    import sys
    import logging
    
    logging.basicConfig(level=logging.DEBUG, 
                       format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
    
    # Import and run your main server
    from main import *
  2. Run with debug output:

    uv run --active debug_server.py
Success Indicators

Know when each step is working correctly:

After Connector Installation

uv pip list | grep cdata
# ✅ Should show: cdata-{datasource}-connector

After Connection Test

# ✅ Successful connection shows:
Successfully connected! Found X tables.
  - TableName1
  - TableName2
  ...

After Server Test

uv run --active main.py
# ✅ Should show: Starting server
# (Server will wait for connections - this is normal)

In Claude Desktop

  • ✅ Small plug icon appears next to your server name
  • ✅ First query returns data without errors
  • ✅ Example: "What tables are available?" returns a list

Getting Help

If you're still having issues:

  1. Check connector documentation: https://cdn.cdata.com/help/{datasource}/
  2. Join CData Community: https://community.cdata.com
  3. Report MCP server issues: Create an issue in this repository
  4. Contact CData support: For connector-specific problems

License

This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.

Supported Sources

250+ Supported Data Sources
AccessAct CRMAct-OnActive Directory
ActiveCampaignAcumaticaAdobe AnalyticsAdobe Commerce
ADPAirtableAlloyDBAmazon Athena
Amazon DynamoDBAmazon MarketplaceAmazon S3Asana
Authorize.NetAvalara AvaTaxAvroAzure Active Directory
Azure Analysis ServicesAzure Data CatalogAzure Data Lake StorageAzure DevOps
Azure SynapseAzure TableBasecampBigCommerce
BigQueryBing AdsBing SearchBitbucket
Blackbaud FE NXTBoxBullhorn CRMCassandra
CertiniaCloudantCockroachDBConfluence
Cosmos DBCouchbaseCouchDBCSV
CventDatabricksDB2DocuSign
DropboxDynamics 365Dynamics 365 Business CentralDynamics CRM
Dynamics GPDynamics NAVeBayeBay Analytics
ElasticsearchEmailEnterpriseDBEpicor Kinetic
Exact OnlineExcelExcel OnlineFacebook
Facebook AdsFHIRFreshdeskFTP
GitHubGmailGoogle Ad ManagerGoogle Ads
Google AnalyticsGoogle CalendarGoogle Campaign Manager 360Google Cloud Storage
Google ContactsGoogle Data CatalogGoogle DirectoryGoogle Drive
Google SearchGoogle SheetsGoogle SpannerGraphQL
GreenhouseGreenplumHarperDBHBase
HCL DominoHDFSHighriseHive
HubDBHubSpotIBM Cloud Data EngineIBM Cloud Object Storage
IBM InformixImpalaInstagramJDBC-ODBC Bridge
JiraJira AssetsJira Service ManagementJSON
KafkaKintoneLDAPLinkedIn
LinkedIn AdsMailChimpMariaDBMarketo
MarkLogicMicrosoft DataverseMicrosoft Entra IDMicrosoft Exchange
Microsoft OneDriveMicrosoft PlannerMicrosoft ProjectMicrosoft Teams
Monday.comMongoDBMYOB AccountRightMySQL
nCinoNeo4JNetSuiteOData
OdooOffice 365OktaOneNote
OracleOracle EloquaOracle Financials CloudOracle HCM Cloud
Oracle SalesOracle SCMOracle Service CloudOutreach.io
ParquetPaylocityPayPalPhoenix
PingOnePinterestPipedrivePostgreSQL
Power BI XMLAPrestoQuickbaseQuickBooks
QuickBooks OnlineQuickBooks TimeRaisers Edge NXTReckon
Reckon Accounts HostedRedisRedshiftREST
RSSSage 200Sage 300Sage 50 UK
Sage Cloud AccountingSage IntacctSalesforceSalesforce Data Cloud
Salesforce Financial Service CloudSalesforce MarketingSalesforce Marketing Cloud Account EngagementSalesforce Pardot
SalesloftSAPSAP Ariba ProcurementSAP Ariba Source
SAP Business OneSAP BusinessObjects BISAP ByDesignSAP Concur
SAP FieldglassSAP HANASAP HANA XS AdvancedSAP Hybris C4C
SAP Netweaver GatewaySAP SuccessFactorsSAS Data SetsSAS xpt
SendGridServiceNowSFTPSharePoint
SharePoint Excel ServicesShipStationShopifySingleStore
SlackSmartsheetSnapchat AdsSnowflake
SparkSplunkSQL Analysis ServicesSQL Server
SquareStripeSugar CRMSuiteCRM
SurveyMonkeySybaseSybase IQTableau CRM Analytics
TallyTaxJarTeradataTier1
TigerGraphTrelloTrinoTwilio
TwitterTwitter AdsVeeva CRMVeeva Vault
Wave FinancialWooCommerceWordPressWorkday
xBaseXeroXMLYouTube Analytics
ZendeskZoho BooksZoho CreatorZoho CRM
Zoho InventoryZoho ProjectsZuora... Dozens More

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages