Skip to content

Commit bb7ed25

Browse files
committed
Update instructions for vs code mcp server
1 parent 62825bb commit bb7ed25

File tree

1 file changed

+115
-33
lines changed

1 file changed

+115
-33
lines changed

MssqlMcp/NodejsMcpServer/README.md

Lines changed: 115 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,9 @@ You: "Show me all customers from New York"
1414
Claude: *queries your MSSQL Database database and gives you the answer in plain English*
1515
```
1616

17-
1817
## How Does It Work? 🛠️
1918

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 MSSQL Database data naturally!
19+
This server leverages the Model Context Protocol (MCP), a versatile framework that acts as a universal translator between AI models and databases. It supports multiple AI assistants including Claude Desktop and VS Code Agent.
2620

2721
### What Can It Do? 📊
2822

@@ -36,19 +30,10 @@ Here's all you need to do:
3630

3731
### Prerequisites
3832
- Node.js 14 or higher
39-
- Claude Desktop
33+
- Claude Desktop or VS Code with Agent extension
4034

4135
### Set up project
4236

43-
- Obtain MSSQL Database server_name, database_name. Create an '.env' file and fill in details with the obtained values
44-
45-
```
46-
SERVER_NAME='<INSERT>'
47-
DATABASE_NAME='<INSERT>'
48-
```
49-
50-
### Getting Started
51-
5237
1. **Install Dependencies**
5338
Run the following command in the root folder to install all necessary dependencies:
5439
```bash
@@ -73,25 +58,122 @@ DATABASE_NAME='<INSERT>'
7358
MSSQL Database Server running on stdio
7459
```
7560

76-
### Add your project details to Claude Destkop's config file, and set parameters accordingly
77-
78-
Open Claude Desktop and Navigate to File -> Settings -> Developer -> Edit Config and open the `claude_desktop_config` file and replace with the values below,
79-
80-
```json
81-
{
82-
"mcpServers": {
83-
"mssql": {
84-
"command": "node",
85-
"args": [ "C:/repos/MCP/dist/index.js" ],
86-
"env": {
87-
"SERVER_NAME": "",
88-
"DATABASE_NAME": "",
89-
"READONLY": "" // set to "true" to restrict to read-only operations
61+
## Configuration Setup
62+
63+
### Option 1: VS Code Agent Setup
64+
65+
1. **Install VS Code Agent Extension**
66+
- Open VS Code
67+
- Go to Extensions (Ctrl+Shift+X)
68+
- Search for "Agent" and install the official Agent extension
69+
70+
2. **Create MCP Configuration File**
71+
- Create a `.vscode/mcp.json` file in your workspace
72+
- Add the following configuration:
73+
74+
```json
75+
{
76+
"servers": {
77+
"mssql-nodejs": {
78+
"type": "stdio",
79+
"command": "node",
80+
"args": ["q:\\Repos\\SQL-AI-samples\\MssqlMcp\\NodejsMcpServer\\dist\\index.js"],
81+
"env": {
82+
"SERVER_NAME": "your-server-name.database.windows.net",
83+
"DATABASE_NAME": "your-database-name",
84+
"READONLY": "false"
85+
}
9086
}
9187
}
88+
}
89+
```
90+
91+
3. **Alternative: User Settings Configuration**
92+
- Open VS Code Settings (Ctrl+,)
93+
- Search for "mcp"
94+
- Click "Edit in settings.json"
95+
- Add the following configuration:
96+
97+
```json
98+
{
99+
"mcp": {
100+
"servers": {
101+
"mssql": {
102+
"command": "node",
103+
"args": ["C:/path/to/your/NodejsMcpServer/dist/index.js"],
104+
"env": {
105+
"SERVER_NAME": "your-server-name.database.windows.net",
106+
"DATABASE_NAME": "your-database-name",
107+
"READONLY": "false"
108+
}
109+
}
110+
}
92111
}
93112
}
113+
```
114+
115+
4. **Restart VS Code**
116+
- Close and reopen VS Code for the changes to take effect
117+
118+
5. **Verify MCP Server**
119+
- Open Command Palette (Ctrl+Shift+P)
120+
- Run "MCP: List Servers" to verify your server is configured
121+
- You should see "mssql" in the list of available servers
122+
123+
### Option 2: Claude Desktop Setup
124+
125+
1. **Open Claude Desktop Settings**
126+
- Navigate to File → Settings → Developer → Edit Config
127+
- Open the `claude_desktop_config` file
128+
129+
2. **Add MCP Server Configuration**
130+
Replace the content with the configuration below, updating the path and credentials:
131+
132+
```json
133+
{
134+
"mcpServers": {
135+
"mssql": {
136+
"command": "node",
137+
"args": ["C:/path/to/your/NodejsMcpServer/dist/index.js"],
138+
"env": {
139+
"SERVER_NAME": "your-server-name.database.windows.net",
140+
"DATABASE_NAME": "your-database-name",
141+
"READONLY": "false"
142+
}
143+
}
144+
}
145+
}
146+
```
94147

95-
```
148+
3. **Restart Claude Desktop**
149+
- Close and reopen Claude Desktop for the changes to take effect
150+
151+
### Configuration Parameters
152+
153+
- **SERVER_NAME**: Your MSSQL Database server name (e.g., `my-server.database.windows.net`)
154+
- **DATABASE_NAME**: Your database name
155+
- **READONLY**: Set to `"true"` to restrict to read-only operations, `"false"` for full access
156+
- **Path**: Update the path in `args` to point to your actual project location
157+
158+
## Sample Configurations
159+
160+
You can find sample configuration files in the `src/samples/` folder:
161+
- `claude_desktop_config.json` - For Claude Desktop
162+
- `vscode_agent_config.json` - For VS Code Agent
163+
164+
## Usage Examples
165+
166+
Once configured, you can interact with your database using natural language:
167+
168+
- "Show me all users from New York"
169+
- "Create a new table called products with columns for id, name, and price"
170+
- "Update all pending orders to completed status"
171+
- "List all tables in the database"
172+
173+
## Security Notes
174+
175+
- The server requires a WHERE clause for read operations to prevent accidental full table scans
176+
- Update operations require explicit WHERE clauses for security
177+
- Set `READONLY: "true"` in production environments if you only need read access
96178

97-
You should now have successfully configured the MCP server for MSSQL Database with Claude Desktop. This setup allows you to seamlessly interact with MSSQL Database through the MCP server.
179+
You should now have successfully configured the MCP server for MSSQL Database with your preferred AI assistant. This setup allows you to seamlessly interact with MSSQL Database through natural language queries!

0 commit comments

Comments
 (0)