cdata-mcp-gateway-for-mssql
Enables Large Language Models (LLMs) to interact with live Microsoft SQL Server databases using natural language queries, bypassing the need for explicit SQL coding. This tool establishes a read-only Model Context Protocol (MCP) endpoint, specifically tailored for integration with clients such as Claude Desktop.
Author

CDataSoftware
Quick Info
Actions
Tags
CData Read-Only Bridge for Microsoft SQL Server via MCP
This utility establishes a Model Context Protocol (MCP) server layer to access data resident in Microsoft SQL Server instances in a read-only fashion.
:warning: Important Note on Capabilities: This specific implementation provides read-only access. For a comprehensive solution offering full Create, Read, Update, and Delete (CRUD) operations, alongside action execution, users are advised to obtain the complete version: CData MCP Server for Microsoft SQL Server (Beta).
Core Functionality
The primary objective of this project is to enable Generative AI systems, such as Claude Desktop, to query dynamic data originating from Microsoft SQL Server. This functionality is underpinned by leveraging the CData JDBC Driver for Microsoft SQL Server driver link.
The driver abstracts the SQL Server structure into a relational model accessible via JDBC. This server component wraps the driver, presenting the SQL Server data through a standardized MCP interface, thus facilitating data retrieval via conversational queries, eliminating the prerequisite of writing T-SQL.
Deployment Procedure
Follow these sequential steps to deploy the read-only data bridge:
1. Acquire Source Code: Clone the repository from its origin:
bash
git clone https://github.com/cdatasoftware/microsoft-sql-server-mcp-server-by-cdata.git
cd microsoft-sql-server-mcp-server-by-cdata
2. Compile Artifacts: Execute the build process using Maven:
bash
mvn clean install
This action generates the primary executable JAR: CDataMCP-jar-with-dependencies.jar
3. Driver Installation: Secure the necessary CData JDBC Driver for Microsoft SQL Server and install it: Driver Download
4. Driver Activation/Licensing:
* Navigate to the driver's installed library directory (e.g., C:\Program Files\CData\CData JDBC Driver for Microsoft SQL Server\ or /Applications/CData JDBC Driver for Microsoft SQL Server/).
* Activate the license by executing:
bash
java -jar cdata.jdbc.sql.jar --license
* Input your required credentials (Name, Email, and the license string, often "TRIAL" for evaluation).
3. Data Source Configuration (Connection String Generation):
* Launch the connection utility: java -jar cdata.jdbc.sql.jar.
* Configure the parameters specific to your SQL Server instance (e.g., server address, credentials). Perform a connection test.
> OAuth Caveat: If OAuth is employed, browser-based authentication will be required during the test.
* Copy the resulting successful JDBC connection string.
4. Configuration File Creation (.prp): Create a properties file (e.g., sqlserver-access.prp) defining the server metadata and connection details:
* Prefix: Identifier prefix for exposed tools.
* ServerName: Human-readable name for the exposed service.
* ServerVersion: Version identifier.
* DriverPath: Absolute path to the downloaded JDBC JAR file.
* DriverClass: Fully qualified class name of the driver (e.g., cdata.jdbc.sql.SQLDriver).
* JdbcUrl: The connection string obtained in the previous step.
* Tables: Specify a comma-separated list of desired tables, or leave empty (Tables=) to expose all accessible schemas.
env
Prefix=sqldb
ServerName=LiveMSSQL
ServerVersion=2.1
DriverPath=ABSOLUTE/PATH/TO/cdata.jdbc.sql.jar
DriverClass=cdata.jdbc.sql.SQLDriver
JdbcUrl=jdbc:sql:User=...;
Tables=Customers,Orders
Integration with LLM Client (e.g., Claude Desktop)
To make this data source available to your AI client, modify its configuration file (claude_desktop_config.json):
1. Update Client Configuration: Add a new entry under mcpServers using the tool prefix (sqldb in the example) to point to the Java executable and the server JAR, passing the .prp file as an argument.
**Windows Path Example:**
```json
{
"mcpServers": {
"sqldb": {
"command": "C:\Program Files\Java\bin\java.exe",
"args": [
"-jar",
"C:\Path\To\Project\CDataMCP-jar-with-dependencies.jar",
"C:\Path\To\Project\sqlserver-access.prp"
]
},
...
}
}
```
**Linux/Mac Path Example:**
```json
{
"mcpServers": {
"sqldb": {
"command": "/usr/bin/java",
"args": [
"-jar",
"/path/to/project/CDataMCP-jar-with-dependencies.jar",
"/path/to/project/sqlserver-access.prp"
]
},
...
}
}
```
- Reload Client Application: Completely terminate and restart the LLM client application to register the new server endpoint.
Direct Server Execution
Alternatively, the MCP server can be launched independently (communication relies on standard I/O): ```bash java -jar /PATH/TO/CDataMCP-jar-with-dependencies.jar /PATH/TO/sqlserver-access.prp
Constraint: Due to reliance on
stdiocommunication, the server must execute on the same host machine as the consuming client application.
Querying Capabilities
Once linked, the AI client can formulate natural language requests concerning the database contents. The system automatically invokes the appropriate underlying MCP tools. * Example Query: "What is the total sales volume for products in the 'Electronics' category last quarter?"
Exposed Toolset
Tool names are prefixed using the value specified in Prefix (e.g., sqldb).
* {prefix}_get_tables: Fetches metadata listing all accessible tables. CSV output format.
* {prefix}_get_columns: Retrieves the schema definition for a specified table name. CSV output format, requiring a table name argument.
* {prefix}_run_query: Allows direct execution of custom SELECT statements against the SQL Server instance.
Support and Licensing
This software is distributed under the permissive MIT License. Refer to the LICENSE file for full terms regarding usage and modification.
For technical difficulties connecting to SQL Server or issues with the MCP bridge, engage with the CData Support Team or join the CData User Community for broader assistance.
Supported Data Ecosystems
CData drivers connect to an extensive catalog of data sources. This specific driver targets Microsoft SQL Server, but the underlying technology supports hundreds of systems, including (but not limited to): Act!, Acumatica, Amazon S3, Azure DevOps, BigQuery, Confluence, Dynamics, Elasticsearch, GitHub, HubSpot, Jira, Kafka, MongoDB, MySQL, NetSuite, Oracle, PostgreSQL, Salesforce, SAP, ServiceNow, Snowflake, Splunk, Stripe, Teradata, and many others.
