@yuuzu/sql-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +177 -0
- package/dist/index.js +93894 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# @yuuzu/sql-mcp
|
|
2
|
+
|
|
3
|
+
[](https://github.com/yuuzu/sql-mcp/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/@yuuzu/sql-mcp)
|
|
5
|
+
|
|
6
|
+
A Model Context Protocol (MCP) server for MSSQL and PostgreSQL database operations.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
# Using bunx (recommended)
|
|
12
|
+
bunx @yuuzu/sql-mcp
|
|
13
|
+
|
|
14
|
+
# Using npx
|
|
15
|
+
npx @yuuzu/sql-mcp
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- **Multi-database support**: MSSQL and PostgreSQL
|
|
21
|
+
- **8 tools** for database operations
|
|
22
|
+
- **Three query modes**: safe, write, full
|
|
23
|
+
- **Advanced authentication**: Windows Auth (MSSQL), SSL certificates (PostgreSQL)
|
|
24
|
+
|
|
25
|
+
## Tools
|
|
26
|
+
|
|
27
|
+
| Tool | Description |
|
|
28
|
+
|------|-------------|
|
|
29
|
+
| `connect-database` | Connect to a database server |
|
|
30
|
+
| `disconnect` | Disconnect from the current connection |
|
|
31
|
+
| `connection-status` | Check connection status and query mode |
|
|
32
|
+
| `list-databases` | List all databases on the server |
|
|
33
|
+
| `switch-database` | Switch to a different database |
|
|
34
|
+
| `list-tables` | List all tables and views |
|
|
35
|
+
| `describe-table` | Get table schema details |
|
|
36
|
+
| `execute-query` | Execute SQL queries |
|
|
37
|
+
|
|
38
|
+
## Query Modes
|
|
39
|
+
|
|
40
|
+
Control query permissions via `SQL_MCP_MODE` environment variable:
|
|
41
|
+
|
|
42
|
+
| Mode | Allowed Operations | Description |
|
|
43
|
+
|------|-------------------|-------------|
|
|
44
|
+
| `safe` (default) | SELECT, WITH, EXPLAIN | Read-only, safest |
|
|
45
|
+
| `write` | + INSERT, UPDATE, DELETE | Allows data modification |
|
|
46
|
+
| `full` | + CREATE, DROP, ALTER, TRUNCATE | Full access, use with caution |
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Example: Enable write mode
|
|
50
|
+
SQL_MCP_MODE=write bunx @yuuzu/sql-mcp
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Usage Examples
|
|
54
|
+
|
|
55
|
+
### Claude Desktop Configuration
|
|
56
|
+
|
|
57
|
+
Add to your `claude_desktop_config.json`:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"mcpServers": {
|
|
62
|
+
"sql-mcp": {
|
|
63
|
+
"command": "bunx",
|
|
64
|
+
"args": ["@yuuzu/sql-mcp"],
|
|
65
|
+
"env": {
|
|
66
|
+
"SQL_MCP_MODE": "safe"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Connect to MSSQL
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"tool": "connect-database",
|
|
78
|
+
"arguments": {
|
|
79
|
+
"engine": "mssql",
|
|
80
|
+
"server": "localhost",
|
|
81
|
+
"port": 1433,
|
|
82
|
+
"user": "sa",
|
|
83
|
+
"password": "your_password",
|
|
84
|
+
"database": "master"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Connect to PostgreSQL
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"tool": "connect-database",
|
|
94
|
+
"arguments": {
|
|
95
|
+
"engine": "postgres",
|
|
96
|
+
"server": "localhost",
|
|
97
|
+
"port": 5432,
|
|
98
|
+
"user": "postgres",
|
|
99
|
+
"password": "your_password",
|
|
100
|
+
"database": "postgres"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Connect with Windows Authentication (MSSQL)
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"tool": "connect-database",
|
|
110
|
+
"arguments": {
|
|
111
|
+
"engine": "mssql",
|
|
112
|
+
"server": "localhost",
|
|
113
|
+
"windowsAuth": true
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Connect with SSL (PostgreSQL)
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"tool": "connect-database",
|
|
123
|
+
"arguments": {
|
|
124
|
+
"engine": "postgres",
|
|
125
|
+
"server": "your-server.com",
|
|
126
|
+
"user": "postgres",
|
|
127
|
+
"password": "your_password",
|
|
128
|
+
"ssl": {
|
|
129
|
+
"rejectUnauthorized": true,
|
|
130
|
+
"ca": "/path/to/ca-certificate.crt"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Development
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Install dependencies
|
|
140
|
+
bun install
|
|
141
|
+
|
|
142
|
+
# Run in development mode
|
|
143
|
+
bun run dev
|
|
144
|
+
|
|
145
|
+
# Run tests
|
|
146
|
+
bun test
|
|
147
|
+
|
|
148
|
+
# Run tests with coverage
|
|
149
|
+
bun test --coverage
|
|
150
|
+
|
|
151
|
+
# Build
|
|
152
|
+
bun run build
|
|
153
|
+
|
|
154
|
+
# Type check
|
|
155
|
+
bun run typecheck
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Release
|
|
159
|
+
|
|
160
|
+
Releases are automated via GitHub Actions. To create a new release:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Create and push a version tag
|
|
164
|
+
git tag v1.0.0
|
|
165
|
+
git push origin v1.0.0
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
This will:
|
|
169
|
+
1. Build the project
|
|
170
|
+
2. Publish to npm with provenance
|
|
171
|
+
3. Create a GitHub Release with auto-generated release notes
|
|
172
|
+
|
|
173
|
+
**Requirements**: Set `NPM_TOKEN` secret in your GitHub repository settings.
|
|
174
|
+
|
|
175
|
+
## License
|
|
176
|
+
|
|
177
|
+
MIT
|