|
| 1 | +# Azure SQL DB MCP Server |
| 2 | + |
| 3 | +<div align="center"> |
| 4 | + <img src="./src/img/logo.png" alt="Azure SQL DB MCP server logo" width="400"/> |
| 5 | +</div> |
| 6 | + |
| 7 | +## What is this? 🤔 |
| 8 | + |
| 9 | +This is a server that lets your LLMs (like Claude) talk directly to your Azure SQL DB data! Think of it as a friendly translator that sits between your AI assistant and your database, making sure they can chat securely and efficiently. |
| 10 | + |
| 11 | +### Quick Example |
| 12 | +```text |
| 13 | +You: "What were our top 10 customers last month?" |
| 14 | +Claude: *queries your Azure SQL DB database and gives you the answer in plain English* |
| 15 | +``` |
| 16 | + |
| 17 | + |
| 18 | +## How Does It Work? 🛠️ |
| 19 | + |
| 20 | +This server leverages the Model Context Protocol (MCP), a versatile framework that acts as a universal translator between AI models and databases. Although MCP is built to support any AI model, it is currently accessible as a developer preview in Claude Desktop. |
| 21 | + |
| 22 | +Here's all you need to do: |
| 23 | +1. Set up project (see below) |
| 24 | +2. Add your project details to Claude Desktop's config file |
| 25 | +3. Start chatting with your Azure SQL DB data naturally! |
| 26 | + |
| 27 | +### What Can It Do? 📊 |
| 28 | + |
| 29 | +- Run Azure SQL DB queries by just asking questions in plain English |
| 30 | + |
| 31 | +## Quick Start 🚀 |
| 32 | + |
| 33 | +### Prerequisites |
| 34 | +- Node.js 14 or higher |
| 35 | +- Claude Desktop |
| 36 | + |
| 37 | +### Set up project |
| 38 | + |
| 39 | +- Obtain Azure SQL DB server_name, database_name. Create an '.env' file and fill in details with the obtained values |
| 40 | + |
| 41 | +``` |
| 42 | +SERVER_NAME='<INSERT>' |
| 43 | +DATABASE_NAME='<INSERT>' |
| 44 | +``` |
| 45 | + |
| 46 | +### Getting Started |
| 47 | + |
| 48 | +1. **Install Dependencies** |
| 49 | + Run the following command in the root folder to install all necessary dependencies: |
| 50 | + ```bash |
| 51 | + npm install |
| 52 | + ``` |
| 53 | + |
| 54 | +2. **Build the Project** |
| 55 | + Compile the project by running: |
| 56 | + ```bash |
| 57 | + npm run build |
| 58 | + ``` |
| 59 | + |
| 60 | +3. **Start the Server** |
| 61 | + Navigate to the `dist` folder and start the server: |
| 62 | + ```bash |
| 63 | + npm start |
| 64 | + ``` |
| 65 | + |
| 66 | +4. **Confirmation Message** |
| 67 | + You should see the following message: |
| 68 | + ``` |
| 69 | + Azure SQL DB Server running on stdio |
| 70 | + ``` |
| 71 | + |
| 72 | +### Add your project details to Claude Destkop's config file, and set parameters accordingly |
| 73 | + |
| 74 | +Open Claude Desktop and Navigate to File -> Settings -> Developer -> Edit Config and open the `claude_desktop_config` file and replace with the values below, |
| 75 | + |
| 76 | +```json |
| 77 | +{ |
| 78 | + "mcpServers": { |
| 79 | + "mssql": { |
| 80 | + "command": "node", |
| 81 | + "args": [ "C:/repos/MCP/dist/index.js" ], |
| 82 | + "env": { |
| 83 | + "SERVER_NAME": "", |
| 84 | + "DATABASE_NAME": "", |
| 85 | + "READONLY": "" // set to "true" to restrict to read-only operations |
| 86 | + } |
| 87 | + } |
| 88 | + } |
| 89 | + } |
| 90 | + |
| 91 | +``` |
| 92 | + |
| 93 | +You should now have successfully configured the MCP server for Azure SQL DB with Claude Desktop. This setup allows you to seamlessly interact with Azure SQL DB through the MCP server. |
0 commit comments