SQL Server Table Assistant - Modal Context Protocol
About
SQL Server Table Assistant - Modal Context Protocol is an application that lets you interact with a specific SQL Server table using natural language. It uses the Modal Context Protocol as a communication layer between LLMs and your data source, and is based on the original…
Details
- Author
- hblaDCOM
- Downloads
- 149
- Categories
- AI
Jump to
- Chat with a SQL Server table using plain English.
- Iteratively refine SQL queries with user feedback.
- View results in well‑formatted tables.
- Automatic query history and logging.
- Perform no‑code CRUD operations via conversation.
- Secure single‑table access with token optimization.
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
SQL Server Table Assistant - Modal Context ProtocolCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Clone the repository, install dependencies with pip install -r requirements.txt, and create a .env file with Azure OpenAI credentials and SQL Server connection details. Then run python mcp-ssms-client.py and type your requests in plain English. Special commands like /diagnose, /refresh_schema, and /history are available.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"sql server table assistant - modal context protocol": {
"sql-server-table-assistant": {
"command": "python",
"args": [
"mcp-ssms-client.py"
]
}
}
}
}
McpServers
{
"sql-server-table-assistant": {
"command": "python",
"args": [
"mcp-ssms-client.py"
]
}
}
SQL Server Table Assistant - Modal Context Protocol
This application lets you interact with a specific SQL Server table using natural language, leveraging the Modal Context Protocol as a communication layer between LLMs and your data source.
This project is based on the mcp-sql-server-natural-lang repository by Aman Pachori, with modifications to focus on single table access.
Key Features:
Talk to Your Table: Chat with a specific SQL Server table using plain English
SQL Query Iteration: Provide feedback to refine SQL queries until they meet your needs
Beautiful Tabular Results: View query results in well-formatted tables for better readability
Query History Logging: Automatically save queries, iterations, and results for future reference
No-Code Table Operations: Query, insert, update, and delete data through natural conversations
Secure, Limited Access: Connect to only one table with restricted credentials for enhanced security
MCP-Enhanced Accuracy: Achieve precise table interactions through Modal Context Protocol
Context-Aware Conversations: Maintain context across multiple queries
Natural Language Explanations: Get plain English explanations of query results
Token Optimization: Smart caching and context management to minimize API usage
What is MCP?
MCP (Modal Context Protocol) is a methodology that standardizes how context is bound to LLMs, providing a standard way to connect AI models to different data sources and tools.Single Table Mode
This application runs in "Single Table Mode" which provides several advantages:
1. Enhanced Security: Access is limited to a single table rather than the entire database
2. Simpler Permissions: Users need minimal permissions (just for the specific table)
3. Focused Experience: The assistant is specialized for working with just one table
4. Reduced Risk: Prevents accidental access to sensitive data in other tables
Token Optimization
This application implements several strategies to minimize token usage and prevent rate limiting:
1. Smart Schema Summarization: Instead of sending the entire table schema to the model, a concise summary is created
2. Response Caching: Similar queries and explanations are cached to avoid redundant API calls
3. Minimal Prompt Design: System prompts and user instructions are optimized for brevity
4. Conversation Management: Only recent and relevant messages are included in the context
5. Dedicated System Prompts: Different prompts for different tasks (schema, query generation, explanations)
6. Selective Result Transmission: Large result sets are trimmed before being sent to the model
7. Token Parameter Tuning: Request parameters like max_tokens are set conservatively
These optimizations allow the application to function smoothly even with large tables and complex queries, while staying within API rate limits.
Prerequisites
Before you get started, make sure you have the following:- Python 3.12+ installed on your machine
- A valid Azure OpenAI deployment with API access
- SQL Server with a table that you want to interact with
- Limited user credentials with access to only that table
Getting Started
Follow these steps to get the project up and running:1. Clone the Repository
git clone https://github.com/yourusername/sql-server-table-assistant.git
cd sql-server-table-assistant
2. Install Dependencies
pip install -r requirements.txt
3. Setup Environment Variables
Create a .env file in the root of the project and add the following:
```dotenv
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.
