mcp-sql-bridge 1.0.0__tar.gz
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.
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 mcp-sql-bridge contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-sql-bridge
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: MCP server bridge for SQL operations (SQLite, PostgreSQL, MySQL)
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Author: Firas Mosbahi
|
|
7
|
+
Author-email: you@example.com
|
|
8
|
+
Requires-Python: >=3.11,<4.0
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Provides-Extra: mysql
|
|
15
|
+
Provides-Extra: postgres
|
|
16
|
+
Provides-Extra: pro
|
|
17
|
+
Requires-Dist: mcp
|
|
18
|
+
Requires-Dist: psycopg ; extra == "postgres" or extra == "pro"
|
|
19
|
+
Requires-Dist: pydantic
|
|
20
|
+
Requires-Dist: pymysql ; extra == "mysql" or extra == "pro"
|
|
21
|
+
Requires-Dist: sqlalchemy
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# MCP SQL Bridge
|
|
25
|
+
|
|
26
|
+
**Local-SQL-Insight** — Give your AI assistant direct, read-only access to your SQL databases over the [Model Context Protocol](https://modelcontextprotocol.io). No APIs, no cloud. Your data stays on your machine.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Why use this?
|
|
31
|
+
|
|
32
|
+
- **Schema-aware AI** — The agent sees table names, columns, and full `CREATE TABLE` DDL so it can write correct SQL.
|
|
33
|
+
- **Business context** — Expose a project `README.md` as a resource so the AI understands your domain and conventions.
|
|
34
|
+
- **Read-only by design** — Only `SELECT` is allowed. No accidental writes or schema changes.
|
|
35
|
+
- **Stdio transport** — Works with Cursor, Claude Desktop, and any MCP host. No ports or network setup.
|
|
36
|
+
- **Multi-database (Pro)** — Use the same tools against SQLite, PostgreSQL, and MySQL by switching a `backend` and connection string.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Quick start
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
git clone <your-repo-url>
|
|
44
|
+
cd mcp-sql-bridge
|
|
45
|
+
poetry install
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Then plug the server into your editor or desktop app (see below).
|
|
49
|
+
|
|
50
|
+
**Run & test:** See **[RUN_AND_TEST.md](RUN_AND_TEST.md)** for how to run the MCP server, the web server, unit tests, and Docker-based integration tests (e.g. `poetry run python scripts/run_docker_integration.py`).
|
|
51
|
+
|
|
52
|
+
### Web server (optional)
|
|
53
|
+
|
|
54
|
+
A small FastAPI app provides a **landing page**, **Swagger UI**, and **documentation** (MkDocs):
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
poetry install --with web
|
|
58
|
+
mkdocs build # build docs (optional; without this, /documentation shows build instructions)
|
|
59
|
+
poetry run mcp-sql-bridge-web
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Open [http://localhost:8000](http://localhost:8000) for the home page, [http://localhost:8000/docs](http://localhost:8000/docs) for Swagger, [http://localhost:8000/redoc](http://localhost:8000/redoc) for ReDoc, and [http://localhost:8000/documentation](http://localhost:8000/documentation) for the full docs site (after `mkdocs build`).
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## How to use with Cursor
|
|
67
|
+
|
|
68
|
+
1. **Install the server** (if not already):
|
|
69
|
+
```bash
|
|
70
|
+
cd /path/to/mcp-sql-bridge
|
|
71
|
+
poetry install
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
2. **Configure MCP**
|
|
75
|
+
Open Cursor Settings → **Tools & MCP** (or edit the config file directly).
|
|
76
|
+
Add the server using the template in **`mcp-config.json`** in this repo:
|
|
77
|
+
|
|
78
|
+
- **Option A — Global config**
|
|
79
|
+
Put the contents of `mcp-config.json` into:
|
|
80
|
+
- **macOS / Linux:** `~/.cursor/mcp.json`
|
|
81
|
+
- **Windows:** `%APPDATA%\Cursor\mcp.json`
|
|
82
|
+
|
|
83
|
+
- **Option B — Project config**
|
|
84
|
+
Copy `mcp-config.json` into your project as `.cursor/mcp.json` (and adjust the `cwd` path to this repo if needed).
|
|
85
|
+
|
|
86
|
+
3. **Set the path**
|
|
87
|
+
In the config, set `cwd` (or the path in `args`) to the **absolute path** of your `mcp-sql-bridge` project directory so Cursor can run `poetry run mcp-sql-bridge` from there.
|
|
88
|
+
|
|
89
|
+
4. **Restart Cursor**
|
|
90
|
+
MCP servers load at startup. Restart Cursor after changing the config.
|
|
91
|
+
|
|
92
|
+
5. **Use it**
|
|
93
|
+
In any chat, the AI can call **Local-SQL-Insight** tools: `list_tables`, `execute_readonly_query`, and read the **Database README** resource.
|
|
94
|
+
- For SQLite, point it at a file path (e.g. `./data/app.db`) with `backend: "sqlite"` or by omitting `backend`.
|
|
95
|
+
- For PostgreSQL/MySQL (Pro), provide a `backend` and `connection_string` URL.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## How to use with Claude Desktop
|
|
100
|
+
|
|
101
|
+
1. **Install the server** (if not already):
|
|
102
|
+
```bash
|
|
103
|
+
cd /path/to/mcp-sql-bridge
|
|
104
|
+
poetry install
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
2. **Locate Claude’s config file**
|
|
108
|
+
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
109
|
+
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
110
|
+
|
|
111
|
+
3. **Add the MCP server**
|
|
112
|
+
Add a `mcpServers` entry (or merge into existing) like this, using the **absolute path** to your `mcp-sql-bridge` directory:
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"mcpServers": {
|
|
117
|
+
"local-sql-insight": {
|
|
118
|
+
"command": "poetry",
|
|
119
|
+
"args": ["run", "mcp-sql-bridge"],
|
|
120
|
+
"cwd": "/absolute/path/to/mcp-sql-bridge"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
If Claude Desktop uses a different Python environment, you can instead use the full path to the `mcp-sql-bridge` executable in the project’s virtualenv, for example:
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"mcpServers": {
|
|
131
|
+
"local-sql-insight": {
|
|
132
|
+
"command": "/absolute/path/to/mcp-sql-bridge/.venv/bin/mcp-sql-bridge",
|
|
133
|
+
"args": []
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
4. **Restart Claude Desktop**
|
|
140
|
+
Restart the app so it picks up the new MCP config.
|
|
141
|
+
|
|
142
|
+
5. **Use it**
|
|
143
|
+
Claude can use the **list_tables** and **execute_readonly_query** tools and read the **Database README** resource.
|
|
144
|
+
- For SQLite, use your SQLite file path (e.g. `~/project/data/app.db`).
|
|
145
|
+
- For PostgreSQL/MySQL, supply connection URLs when the model asks for database details.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## What the server provides
|
|
150
|
+
|
|
151
|
+
| Capability | Description |
|
|
152
|
+
|------------|-------------|
|
|
153
|
+
| **list_tables** | Lists every table, its columns, and the full `CREATE TABLE` statement. Supports `backend: "sqlite" | "postgres" | "mysql"`. |
|
|
154
|
+
| **execute_readonly_query** | Runs a `SELECT` query and returns results as a formatted text table. Supports all backends via `backend` and `connection_string` / `db_path`. |
|
|
155
|
+
| **schema_summary** | Compact overview of tables and key columns for a quick schema scan. |
|
|
156
|
+
| **sample_rows** | Limited sample rows from a given table to understand data shape and example values. |
|
|
157
|
+
| **explain_database** | High-level explanation of the database based on its schema. |
|
|
158
|
+
| **suggest_indexes_for_query** | Heuristic index suggestions for a given SELECT query (no writes). |
|
|
159
|
+
| **Database README** (resource) | Serves `README.md` from the server’s current working directory so the AI can read your project’s business context. |
|
|
160
|
+
| **Database README template** (resource) | A markdown template for per-database README files (owners, conventions, key tables, gotchas). |
|
|
161
|
+
|
|
162
|
+
For SQLite, the server validates that paths point to real SQLite files (magic header check) and returns clear errors if a path is wrong or not a database.
|
|
163
|
+
For PostgreSQL/MySQL, it validates connections and reports connection/auth errors clearly; use read-only roles in production.
|
|
164
|
+
|
|
165
|
+
### Connection strings (PostgreSQL & MySQL)
|
|
166
|
+
|
|
167
|
+
Use the `connection_string` argument with `backend: "postgres"` or `backend: "mysql"` when calling `list_tables` or `execute_readonly_query`.
|
|
168
|
+
|
|
169
|
+
**PostgreSQL** — URL format (password in URL is optional; use env vars in production):
|
|
170
|
+
|
|
171
|
+
- `postgresql://user:password@localhost:5432/dbname`
|
|
172
|
+
- `postgresql://user@localhost:5432/dbname` (no password)
|
|
173
|
+
- `postgresql://localhost:5432/dbname` (peer/auth trust)
|
|
174
|
+
|
|
175
|
+
**MySQL** — URL format:
|
|
176
|
+
|
|
177
|
+
- `mysql://user:password@localhost:3306/dbname`
|
|
178
|
+
- `mariadb://user:password@localhost:3306/dbname`
|
|
179
|
+
|
|
180
|
+
Install optional drivers: `poetry install --extras postgres` and/or `poetry install --extras mysql` (or `--extras pro` for both). Example MCP configs for multi-database setups are in **`examples/mcp-config-pro.json`** and **`examples/README.md`**.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Documentation
|
|
185
|
+
|
|
186
|
+
- [Main README](README.md) (this file) — quick start and usage.
|
|
187
|
+
- [docs/](docs/) — [security and hardening](docs/SECURITY.md), [error taxonomy](docs/ERROR_TAXONOMY.md), [pricing and licensing](docs/PRICING_AND_LICENSING.md), [launch and marketing](docs/LAUNCH_AND_MARKETING.md), [future ideas](docs/FUTURE.md).
|
|
188
|
+
- [CONTRIBUTING.md](CONTRIBUTING.md) — development setup, tests, release, PyPI.
|
|
189
|
+
|
|
190
|
+
## Requirements
|
|
191
|
+
|
|
192
|
+
- **Python 3.11+**
|
|
193
|
+
- **Poetry** (recommended) or `pip` for dependencies
|
|
194
|
+
- Optional extras:
|
|
195
|
+
- `postgres` extra for PostgreSQL (`psycopg`)
|
|
196
|
+
- `mysql` extra for MySQL (`pymysql`)
|
|
197
|
+
|
|
198
|
+
## Feedback and support
|
|
199
|
+
|
|
200
|
+
- **Bug reports and feature ideas:** [Open an issue](https://github.com/firas-mcp-servers/mcp-sql-bridge/issues).
|
|
201
|
+
- **Questions and discussions:** [GitHub Discussions](https://github.com/firas-mcp-servers/mcp-sql-bridge/discussions).
|
|
202
|
+
- Feedback from users (issues, discussions, or contact) is used to prioritize the roadmap and any future paid offerings.
|
|
203
|
+
|
|
204
|
+
## Support & maintenance
|
|
205
|
+
|
|
206
|
+
- Targeted Python: 3.11+
|
|
207
|
+
- MCP: current stable versions at time of release
|
|
208
|
+
- Backwards-compatible changes will be released as minor versions; breaking changes will bump the major or minor version and be noted in `CHANGELOG.md`.
|
|
209
|
+
- The project is intended to be feature-complete after the 0.2.x line; future work will focus on fixes and compatibility updates only.
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## License
|
|
214
|
+
|
|
215
|
+
MIT. See [LICENSE](LICENSE) for details.
|
|
216
|
+
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# MCP SQL Bridge
|
|
2
|
+
|
|
3
|
+
**Local-SQL-Insight** — Give your AI assistant direct, read-only access to your SQL databases over the [Model Context Protocol](https://modelcontextprotocol.io). No APIs, no cloud. Your data stays on your machine.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Why use this?
|
|
8
|
+
|
|
9
|
+
- **Schema-aware AI** — The agent sees table names, columns, and full `CREATE TABLE` DDL so it can write correct SQL.
|
|
10
|
+
- **Business context** — Expose a project `README.md` as a resource so the AI understands your domain and conventions.
|
|
11
|
+
- **Read-only by design** — Only `SELECT` is allowed. No accidental writes or schema changes.
|
|
12
|
+
- **Stdio transport** — Works with Cursor, Claude Desktop, and any MCP host. No ports or network setup.
|
|
13
|
+
- **Multi-database (Pro)** — Use the same tools against SQLite, PostgreSQL, and MySQL by switching a `backend` and connection string.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Quick start
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
git clone <your-repo-url>
|
|
21
|
+
cd mcp-sql-bridge
|
|
22
|
+
poetry install
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then plug the server into your editor or desktop app (see below).
|
|
26
|
+
|
|
27
|
+
**Run & test:** See **[RUN_AND_TEST.md](RUN_AND_TEST.md)** for how to run the MCP server, the web server, unit tests, and Docker-based integration tests (e.g. `poetry run python scripts/run_docker_integration.py`).
|
|
28
|
+
|
|
29
|
+
### Web server (optional)
|
|
30
|
+
|
|
31
|
+
A small FastAPI app provides a **landing page**, **Swagger UI**, and **documentation** (MkDocs):
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
poetry install --with web
|
|
35
|
+
mkdocs build # build docs (optional; without this, /documentation shows build instructions)
|
|
36
|
+
poetry run mcp-sql-bridge-web
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Open [http://localhost:8000](http://localhost:8000) for the home page, [http://localhost:8000/docs](http://localhost:8000/docs) for Swagger, [http://localhost:8000/redoc](http://localhost:8000/redoc) for ReDoc, and [http://localhost:8000/documentation](http://localhost:8000/documentation) for the full docs site (after `mkdocs build`).
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## How to use with Cursor
|
|
44
|
+
|
|
45
|
+
1. **Install the server** (if not already):
|
|
46
|
+
```bash
|
|
47
|
+
cd /path/to/mcp-sql-bridge
|
|
48
|
+
poetry install
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
2. **Configure MCP**
|
|
52
|
+
Open Cursor Settings → **Tools & MCP** (or edit the config file directly).
|
|
53
|
+
Add the server using the template in **`mcp-config.json`** in this repo:
|
|
54
|
+
|
|
55
|
+
- **Option A — Global config**
|
|
56
|
+
Put the contents of `mcp-config.json` into:
|
|
57
|
+
- **macOS / Linux:** `~/.cursor/mcp.json`
|
|
58
|
+
- **Windows:** `%APPDATA%\Cursor\mcp.json`
|
|
59
|
+
|
|
60
|
+
- **Option B — Project config**
|
|
61
|
+
Copy `mcp-config.json` into your project as `.cursor/mcp.json` (and adjust the `cwd` path to this repo if needed).
|
|
62
|
+
|
|
63
|
+
3. **Set the path**
|
|
64
|
+
In the config, set `cwd` (or the path in `args`) to the **absolute path** of your `mcp-sql-bridge` project directory so Cursor can run `poetry run mcp-sql-bridge` from there.
|
|
65
|
+
|
|
66
|
+
4. **Restart Cursor**
|
|
67
|
+
MCP servers load at startup. Restart Cursor after changing the config.
|
|
68
|
+
|
|
69
|
+
5. **Use it**
|
|
70
|
+
In any chat, the AI can call **Local-SQL-Insight** tools: `list_tables`, `execute_readonly_query`, and read the **Database README** resource.
|
|
71
|
+
- For SQLite, point it at a file path (e.g. `./data/app.db`) with `backend: "sqlite"` or by omitting `backend`.
|
|
72
|
+
- For PostgreSQL/MySQL (Pro), provide a `backend` and `connection_string` URL.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## How to use with Claude Desktop
|
|
77
|
+
|
|
78
|
+
1. **Install the server** (if not already):
|
|
79
|
+
```bash
|
|
80
|
+
cd /path/to/mcp-sql-bridge
|
|
81
|
+
poetry install
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
2. **Locate Claude’s config file**
|
|
85
|
+
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
86
|
+
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
87
|
+
|
|
88
|
+
3. **Add the MCP server**
|
|
89
|
+
Add a `mcpServers` entry (or merge into existing) like this, using the **absolute path** to your `mcp-sql-bridge` directory:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"mcpServers": {
|
|
94
|
+
"local-sql-insight": {
|
|
95
|
+
"command": "poetry",
|
|
96
|
+
"args": ["run", "mcp-sql-bridge"],
|
|
97
|
+
"cwd": "/absolute/path/to/mcp-sql-bridge"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
If Claude Desktop uses a different Python environment, you can instead use the full path to the `mcp-sql-bridge` executable in the project’s virtualenv, for example:
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"mcpServers": {
|
|
108
|
+
"local-sql-insight": {
|
|
109
|
+
"command": "/absolute/path/to/mcp-sql-bridge/.venv/bin/mcp-sql-bridge",
|
|
110
|
+
"args": []
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
4. **Restart Claude Desktop**
|
|
117
|
+
Restart the app so it picks up the new MCP config.
|
|
118
|
+
|
|
119
|
+
5. **Use it**
|
|
120
|
+
Claude can use the **list_tables** and **execute_readonly_query** tools and read the **Database README** resource.
|
|
121
|
+
- For SQLite, use your SQLite file path (e.g. `~/project/data/app.db`).
|
|
122
|
+
- For PostgreSQL/MySQL, supply connection URLs when the model asks for database details.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## What the server provides
|
|
127
|
+
|
|
128
|
+
| Capability | Description |
|
|
129
|
+
|------------|-------------|
|
|
130
|
+
| **list_tables** | Lists every table, its columns, and the full `CREATE TABLE` statement. Supports `backend: "sqlite" | "postgres" | "mysql"`. |
|
|
131
|
+
| **execute_readonly_query** | Runs a `SELECT` query and returns results as a formatted text table. Supports all backends via `backend` and `connection_string` / `db_path`. |
|
|
132
|
+
| **schema_summary** | Compact overview of tables and key columns for a quick schema scan. |
|
|
133
|
+
| **sample_rows** | Limited sample rows from a given table to understand data shape and example values. |
|
|
134
|
+
| **explain_database** | High-level explanation of the database based on its schema. |
|
|
135
|
+
| **suggest_indexes_for_query** | Heuristic index suggestions for a given SELECT query (no writes). |
|
|
136
|
+
| **Database README** (resource) | Serves `README.md` from the server’s current working directory so the AI can read your project’s business context. |
|
|
137
|
+
| **Database README template** (resource) | A markdown template for per-database README files (owners, conventions, key tables, gotchas). |
|
|
138
|
+
|
|
139
|
+
For SQLite, the server validates that paths point to real SQLite files (magic header check) and returns clear errors if a path is wrong or not a database.
|
|
140
|
+
For PostgreSQL/MySQL, it validates connections and reports connection/auth errors clearly; use read-only roles in production.
|
|
141
|
+
|
|
142
|
+
### Connection strings (PostgreSQL & MySQL)
|
|
143
|
+
|
|
144
|
+
Use the `connection_string` argument with `backend: "postgres"` or `backend: "mysql"` when calling `list_tables` or `execute_readonly_query`.
|
|
145
|
+
|
|
146
|
+
**PostgreSQL** — URL format (password in URL is optional; use env vars in production):
|
|
147
|
+
|
|
148
|
+
- `postgresql://user:password@localhost:5432/dbname`
|
|
149
|
+
- `postgresql://user@localhost:5432/dbname` (no password)
|
|
150
|
+
- `postgresql://localhost:5432/dbname` (peer/auth trust)
|
|
151
|
+
|
|
152
|
+
**MySQL** — URL format:
|
|
153
|
+
|
|
154
|
+
- `mysql://user:password@localhost:3306/dbname`
|
|
155
|
+
- `mariadb://user:password@localhost:3306/dbname`
|
|
156
|
+
|
|
157
|
+
Install optional drivers: `poetry install --extras postgres` and/or `poetry install --extras mysql` (or `--extras pro` for both). Example MCP configs for multi-database setups are in **`examples/mcp-config-pro.json`** and **`examples/README.md`**.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Documentation
|
|
162
|
+
|
|
163
|
+
- [Main README](README.md) (this file) — quick start and usage.
|
|
164
|
+
- [docs/](docs/) — [security and hardening](docs/SECURITY.md), [error taxonomy](docs/ERROR_TAXONOMY.md), [pricing and licensing](docs/PRICING_AND_LICENSING.md), [launch and marketing](docs/LAUNCH_AND_MARKETING.md), [future ideas](docs/FUTURE.md).
|
|
165
|
+
- [CONTRIBUTING.md](CONTRIBUTING.md) — development setup, tests, release, PyPI.
|
|
166
|
+
|
|
167
|
+
## Requirements
|
|
168
|
+
|
|
169
|
+
- **Python 3.11+**
|
|
170
|
+
- **Poetry** (recommended) or `pip` for dependencies
|
|
171
|
+
- Optional extras:
|
|
172
|
+
- `postgres` extra for PostgreSQL (`psycopg`)
|
|
173
|
+
- `mysql` extra for MySQL (`pymysql`)
|
|
174
|
+
|
|
175
|
+
## Feedback and support
|
|
176
|
+
|
|
177
|
+
- **Bug reports and feature ideas:** [Open an issue](https://github.com/firas-mcp-servers/mcp-sql-bridge/issues).
|
|
178
|
+
- **Questions and discussions:** [GitHub Discussions](https://github.com/firas-mcp-servers/mcp-sql-bridge/discussions).
|
|
179
|
+
- Feedback from users (issues, discussions, or contact) is used to prioritize the roadmap and any future paid offerings.
|
|
180
|
+
|
|
181
|
+
## Support & maintenance
|
|
182
|
+
|
|
183
|
+
- Targeted Python: 3.11+
|
|
184
|
+
- MCP: current stable versions at time of release
|
|
185
|
+
- Backwards-compatible changes will be released as minor versions; breaking changes will bump the major or minor version and be noted in `CHANGELOG.md`.
|
|
186
|
+
- The project is intended to be feature-complete after the 0.2.x line; future work will focus on fixes and compatibility updates only.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## License
|
|
191
|
+
|
|
192
|
+
MIT. See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "mcp-sql-bridge"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = "MCP server bridge for SQL operations (SQLite, PostgreSQL, MySQL)"
|
|
5
|
+
authors = ["Firas Mosbahi <you@example.com>"]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
packages = [{ include = "mcp_sql_bridge", from = "src" }]
|
|
8
|
+
|
|
9
|
+
[tool.poetry.dependencies]
|
|
10
|
+
python = "^3.11"
|
|
11
|
+
mcp = "*"
|
|
12
|
+
sqlalchemy = "*"
|
|
13
|
+
pydantic = "*"
|
|
14
|
+
psycopg = { version = "*", optional = true }
|
|
15
|
+
pymysql = { version = "*", optional = true }
|
|
16
|
+
|
|
17
|
+
[tool.poetry.scripts]
|
|
18
|
+
mcp-sql-bridge = "mcp_sql_bridge.server:main"
|
|
19
|
+
mcp-sql-bridge-web = "web.main:run"
|
|
20
|
+
|
|
21
|
+
[build-system]
|
|
22
|
+
requires = ["poetry-core>=1.0.0"]
|
|
23
|
+
build-backend = "poetry.core.masonry.api"
|
|
24
|
+
|
|
25
|
+
[tool.poetry.group.dev.dependencies]
|
|
26
|
+
pytest = "*"
|
|
27
|
+
ruff = "*"
|
|
28
|
+
|
|
29
|
+
[tool.poetry.group.web.dependencies]
|
|
30
|
+
fastapi = "*"
|
|
31
|
+
uvicorn = { extras = ["standard"], version = "*" }
|
|
32
|
+
mkdocs = "*"
|
|
33
|
+
mkdocs-material = "*"
|
|
34
|
+
|
|
35
|
+
[tool.pytest.ini_options]
|
|
36
|
+
testpaths = ["tests"]
|
|
37
|
+
|
|
38
|
+
[tool.ruff]
|
|
39
|
+
line-length = 100
|
|
40
|
+
target-version = "py311"
|
|
41
|
+
|
|
42
|
+
[tool.ruff.lint]
|
|
43
|
+
select = ["E", "F", "W", "I", "UP", "B", "SIM"]
|
|
44
|
+
ignore = [
|
|
45
|
+
"E501", # line too long — ruff format handles this
|
|
46
|
+
"B008", # do not perform function calls in default arguments
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[tool.ruff.lint.isort]
|
|
50
|
+
known-first-party = ["mcp_sql_bridge"]
|
|
51
|
+
|
|
52
|
+
[tool.poetry.extras]
|
|
53
|
+
postgres = ["psycopg"]
|
|
54
|
+
mysql = ["pymysql"]
|
|
55
|
+
pro = ["psycopg", "pymysql"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""MCP SQL Bridge — MCP server bridge for SQL operations."""
|