mssql-mcp-server
The MS SQL MCP Server is a user-friendly tool that allows AI assistants to directly access and query Microsoft SQL Server databases without any coding experience. Users can ask questions in natural language, enabling the AI to explore and analyze data effectively. All queries are read-only, ensuring the safety of the data while providing a seamless interface for deeper insights.
GitHub Stars
62
User Rating
Not Rated
Favorites
0
Views
26
Forks
29
Issues
5
Installation
Difficulty
BeginnerEstimated Time
5-10 minutes
Requirements
Node.js: 14以上npm: 6以上+1 more
Installation
Installation
Prerequisites
Please specify required software and versions:Node.js: 14 or higher
Access to a Microsoft SQL Server database (on-premises or Azure)
Installation Steps
1. Clone Repository
bash
git clone https://github.com/dperussina/mssql-mcp-server.git
cd mssql-mcp-server
2. Install Dependencies
bash
npm install
3. Copy Environment File
bash
cp .env.example .env
4. Edit Environment File
Edit the.env file with your database credentials.
5. Start Server
bash
npm start
Troubleshooting
Issue: Server won't start Solution: Check Node.js version and reinstall dependencies.Configuration
Configuration
Basic Configuration
Edit the.env file as follows:
DB_USER=your_username
DB_PASSWORD=your_password
DB_SERVER=your_server_name_or_ip
DB_DATABASE=your_database_name
PORT=3333
HOST=0.0.0.0
TRANSPORT=stdio
SERVER_URL=http://localhost:3333
DEBUG=false
QUERY_RESULTS_PATH=/path/to/query_results
Security Settings
Database credentials remain local and are never sent to external services.
Only read-only queries are executed to keep data safe.
Examples
Examples
Basic Usage
Programmatic Usage
javascript
// JavaScript example (Node.js)
const { MCPClient } = require('@modelcontextprotocol/client');
const client = new MCPClient();
await client.connect();
// Execute tool
const result = await client.callTool('toolName', {
parameter1: 'value1',
parameter2: 'value2'
});
console.log(result);
Advanced Examples
Automation Script
bash
#!/bin/bash
Batch processing example
for file in *.txt; do
mcp-tool process "$file"
done
Use Cases
Data analysts using AI assistance to interpret SQL data
Developers quickly exploring database structures through natural conversation
Business analysts gaining insights without SQL expertise
Database administrators providing controlled access to AI tools