cdata-gmail-mcp-adapter-read-only
Expose live Gmail resources via a restricted, query-only Model Context Protocol (MCP) endpoint, leveraging the CData JDBC Driver to translate mail data into relational structures for LLM consumption.
Author

CDataSoftware
Quick Info
Actions
Tags
CData Read-Only MCP Gateway for Gmail
This implementation provides a Model Context Protocol (MCP) server specifically configured for read-only access to Gmail data, facilitated by the CData JDBC Driver.
:warning: Limitation Notice: This build is strictly read-only. For comprehensive data manipulation capabilities (CRUD operations and actions) coupled with a streamlined deployment experience, consider utilizing the complimentary CData MCP Server for Gmail (Beta version).
Rationale
The objective of this specific server is to grant sophisticated Language Models (such as Claude Desktop) the ability to interrogate up-to-the-minute data residing within Gmail. This is achieved by utilizing the robust CData JDBC Driver for Gmail.
The CData JDBC Driver abstracts Gmail interactions, presenting the underlying mailbox contents as conventional SQL-compatible relational schemas.
This wrapper application exposes those schemas via a basic MCP interface. Consequently, AI agents can dynamically retrieve current information simply by posing questions in plain conversational language, entirely bypassing the need to author formal SQL queries.
Deployment Instructions
- Acquire Source Code: Fetch the repository contents:
bash git clone https://github.com/cdatasoftware/gmail-mcp-server-by-cdata.git cd gmail-mcp-server-by-cdata - Compile Artifact: Build the executable JAR file using Maven:
bash mvn clean installThe resulting package will be named:CDataMCP-jar-with-dependencies.jar - Install JDBC Component: Download and install the proprietary CData JDBC Driver for Gmail from: https://www.cdata.com/drivers/gmail/download/jdbc
- License the Driver: Activate the driver component:
- Locate the installation path of the driver JAR (e.g., Windows:
C:\Program Files\CData\CData JDBC Driver for Gmail\, Unix/Mac:/Applications/CData JDBC Driver for Gmail/) - Execute the licensing utility:
bash java -jar cdata.jdbc.gmail.jar --license - Provide your credentials and use "TRIAL" or your official license key when prompted.
- Locate the installation path of the driver JAR (e.g., Windows:
-
Configure Data Source Connectivity: Establish the connection parameters:
-
Launch the utility to generate connection settings:
java -jar cdata.jdbc.gmail.jar -
Define the connection string (handling OAuth workflows in the browser if necessary) and confirm connectivity via "Test Connection".
- Save the resulting JDBC connection string for subsequent steps.
- Define the Configuration Property File (
.prp): Create a configuration file (e.g.,gmail.prp) specifying how the MCP server should present the data source. Ensure the following mandatory entries are present: Prefix: A namespace identifier for the exposed tools.ServerName: A descriptive name for this server instance.ServerVersion: The version identifier.DriverPath: The absolute path to the installed CData JDBC JAR file.DriverClass: The fully qualified class name of the Gmail JDBC driver (e.g.,cdata.jdbc.gmail.GmailDriver).JdbcUrl: The connection string generated in the previous step.Tables: Specify table names explicitly, or leave empty to expose all accessible entities.env Prefix=gmail ServerName=CDataGmail ServerVersion=1.0 DriverPath=PATH\TO\cdata.jdbc.gmail.jar DriverClass=cdata.jdbc.gmail.GmailDriver JdbcUrl=jdbc:gmail:InitiateOAuth=GETANDREFRESH; Tables=
-
Integrating with LLM Clients (e.g., Claude Desktop)
-
Client Configuration File Generation: Prepare the client's configuration file (e.g.,
claude_desktop_config.json) to register this new MCP service. Append the following structure to the existingmcpServersblock, substituting placeholders with actual paths:Windows Path Configuration
json { "mcpServers": { "{classname_dash}": { "command": "PATH\TO\java.exe", "args": [ "-jar", "PATH\TO\CDataMCP-jar-with-dependencies.jar", "PATH\TO\gmail.prp" ] }, ... } }Linux/Mac Path Configuration
json { "mcpServers": { "{classname_dash}": { "command": "/PATH/TO/java", "args": [ "-jar", "/PATH/TO/CDataMCP-jar-with-dependencies.jar", "/PATH/TO/gmail.prp" ] }, ... } }If necessary, relocate the generated configuration file to the client's designated application support directory: Windows relocation example:bash cp C:\PATH\TO\claude_desktop_config.json %APPDATA%\Claude\claude_desktop_config.jsonLinux/Mac relocation example:bash cp /PATH/TO/claude_desktop_config.json /Users/{user}/Library/Application\ Support/Claude/claude_desktop_config.json2. Client Restart: Completely terminate and relaunch the consuming application (Claude Desktop) to ensure the newly defined MCP services are recognized.
Standalone Server Execution
To launch the adapter directly without an integrated client: ```bash java -jar /PATH/TO/CDataMCP-jar-with-dependencies.jar /PATH/TO/gmail.prp
Note: Communication relies on standard input/output (
stdio), meaning the client must execute on the identical host machine as the server process.
Interaction Guidelines
Once integrated, the client application gains access to native tools for reading data structures. Direct tool invocation is typically unnecessary; framing questions contextually about your Gmail data will automatically trigger the required backend calls. Examples include: * "Summarize my appointments scheduled for the upcoming Friday." * "Count the unread emails received yesterday from external domains." * "List the last ten messages tagged with 'Urgent'."
Available Operations (Tools)
Tool names are prefixed based on the ServerName defined in the .prp file (e.g., gmail_...).
* [servername]_get_tables - Fetches the enumerated list of accessible data entities. Use [servername]_get_columns subsequently to inspect schema details. Output is formatted as CSV, starting with a header row.
* [servername]_get_columns - Returns the attribute list (schema) for a specified entity. Precede this call with [servername]_get_tables to identify valid inputs. Output is formatted as CSV, starting with a header row.
* [servername]_run_query - Executes a user-defined SQL SELECT statement against the data structures.
JSON-RPC Invocation Samples (For Scripting)
These examples adhere to the JSON-RPC 2.0 standard for direct interaction with the server endpoint.
Querying Available Entities (gmail_get_tables)
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "gmail_get_tables",
"arguments": {}
}
}
Inspecting Schema (gmail_get_columns)
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "gmail_get_columns",
"arguments": {
"table": "InboxMessages"
}
}
}
Executing a Data Retrieval Command (gmail_run_query)
{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "gmail_run_query",
"arguments": {
"sql": "SELECT Subject, FromAddress FROM [Messages] WHERE IsRead = false LIMIT 5"
}
}
}
Debugging Common Issues
- Server Unseen by Client: Ensure the consumer application (Claude Desktop) has been fully terminated via system tools (Task Manager/Activity Monitor) and restarted.
- Data Retrieval Failure: Verify that the connection string in the
.prpfile precisely matches the validated string generated by the Connection String utility. - Source Connectivity Errors: If authentication or connection issues persist, seek assistance from the CData Support Portal.
- MCP Server Feedback: For general adapter issues or feature requests, engage with the CData User Community.
Licensing
This utility is distributed under the permissive MIT License. Refer to the included LICENSE file for complete usage, modification, and distribution terms.
Supported Data Ecosystems (CData Driver Capabilities)
| Category | Connectors | Category | Connectors |
|---|---|---|---|
| Cloud Storage | Amazon S3, Google Cloud Storage, Azure Data Lake Storage | CRM/Sales | Salesforce, HubSpot, Dynamics CRM, Zoho CRM |
| Databases | PostgreSQL, MySQL, Oracle, SQL Server, BigQuery, Snowflake | ERP/Finance | NetSuite, SAP, QuickBooks Online, Sage Intacct |
| Collaboration | Microsoft Teams, SharePoint, Slack, Confluence, Jira | Marketing | Google Ads, Facebook Ads, Marketo, MailChimp |
| APIs/Web | REST, GraphQL, OData, SOAP | Files/Formats | JSON, XML, CSV, Parquet, Excel |
| ... and many more available through the CData platform. |
