sqlserver-mcp-tools 0.1.2__tar.gz → 0.1.3__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.
- {sqlserver_mcp_tools-0.1.2 → sqlserver_mcp_tools-0.1.3}/PKG-INFO +36 -1
- {sqlserver_mcp_tools-0.1.2 → sqlserver_mcp_tools-0.1.3}/README.md +32 -0
- {sqlserver_mcp_tools-0.1.2 → sqlserver_mcp_tools-0.1.3}/pyproject.toml +8 -1
- sqlserver_mcp_tools-0.1.3/src/mcp_sqlserver/http_server.py +66 -0
- {sqlserver_mcp_tools-0.1.2 → sqlserver_mcp_tools-0.1.3}/src/sqlserver_mcp_tools.egg-info/PKG-INFO +36 -1
- {sqlserver_mcp_tools-0.1.2 → sqlserver_mcp_tools-0.1.3}/src/sqlserver_mcp_tools.egg-info/SOURCES.txt +1 -0
- {sqlserver_mcp_tools-0.1.2 → sqlserver_mcp_tools-0.1.3}/src/sqlserver_mcp_tools.egg-info/entry_points.txt +1 -0
- {sqlserver_mcp_tools-0.1.2 → sqlserver_mcp_tools-0.1.3}/src/sqlserver_mcp_tools.egg-info/requires.txt +4 -0
- {sqlserver_mcp_tools-0.1.2 → sqlserver_mcp_tools-0.1.3}/LICENSE +0 -0
- {sqlserver_mcp_tools-0.1.2 → sqlserver_mcp_tools-0.1.3}/setup.cfg +0 -0
- {sqlserver_mcp_tools-0.1.2 → sqlserver_mcp_tools-0.1.3}/src/mcp_sqlserver/__init__.py +0 -0
- {sqlserver_mcp_tools-0.1.2 → sqlserver_mcp_tools-0.1.3}/src/mcp_sqlserver/connection.py +0 -0
- {sqlserver_mcp_tools-0.1.2 → sqlserver_mcp_tools-0.1.3}/src/mcp_sqlserver/server.py +0 -0
- {sqlserver_mcp_tools-0.1.2 → sqlserver_mcp_tools-0.1.3}/src/mcp_sqlserver/tools.py +0 -0
- {sqlserver_mcp_tools-0.1.2 → sqlserver_mcp_tools-0.1.3}/src/sqlserver_mcp_tools.egg-info/dependency_links.txt +0 -0
- {sqlserver_mcp_tools-0.1.2 → sqlserver_mcp_tools-0.1.3}/src/sqlserver_mcp_tools.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sqlserver-mcp-tools
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: Servidor MCP (Model Context Protocol) para SQL Server com controle de permissões e modo somente-leitura
|
|
5
5
|
Author: hlgurgel
|
|
6
6
|
License-Expression: MIT
|
|
@@ -21,6 +21,9 @@ License-File: LICENSE
|
|
|
21
21
|
Requires-Dist: mcp<2.0,>=1.0.0
|
|
22
22
|
Requires-Dist: pyodbc>=5.0.0
|
|
23
23
|
Requires-Dist: python-dotenv>=1.0.0
|
|
24
|
+
Provides-Extra: server
|
|
25
|
+
Requires-Dist: uvicorn>=0.30.0; extra == "server"
|
|
26
|
+
Requires-Dist: starlette>=0.37.0; extra == "server"
|
|
24
27
|
Dynamic: license-file
|
|
25
28
|
|
|
26
29
|
# mcp-sqlserver
|
|
@@ -150,6 +153,38 @@ Alternativa: apontar para um arquivo `.env` local, mantendo a senha fora do JSON
|
|
|
150
153
|
}
|
|
151
154
|
```
|
|
152
155
|
|
|
156
|
+
## Servidor HTTP (Streamable HTTP)
|
|
157
|
+
|
|
158
|
+
Além do modo local (stdio), o servidor pode ser executado como um **MCP remoto**
|
|
159
|
+
via Streamable HTTP, expondo o endpoint `/mcp`. Instale com o extra `server`:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
pip install 'sqlserver-mcp-tools[server]'
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Inicie o servidor:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
MSSQL_CONNECTION_STRING="DRIVER={ODBC Driver 18 for SQL Server};SERVER=...;DATABASE=...;UID=...;PWD=...;TrustServerCertificate=yes" \
|
|
169
|
+
mcp-sqlserver-http
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Opcionalmente, ajuste host/porta com `MCP_HOST` (padrão `0.0.0.0`) e `MCP_PORT`
|
|
173
|
+
(padrão `8090`). O endpoint MCP fica em `http://<host>:<porta>/mcp`.
|
|
174
|
+
|
|
175
|
+
Para consumir remotamente no opencode:
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"mcp": {
|
|
180
|
+
"sqlserver": {
|
|
181
|
+
"type": "remote",
|
|
182
|
+
"url": "http://10.177.51.228:8090/mcp"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
153
188
|
## Ferramentas disponíveis
|
|
154
189
|
|
|
155
190
|
Somente leitura (sempre disponíveis):
|
|
@@ -125,6 +125,38 @@ Alternativa: apontar para um arquivo `.env` local, mantendo a senha fora do JSON
|
|
|
125
125
|
}
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
+
## Servidor HTTP (Streamable HTTP)
|
|
129
|
+
|
|
130
|
+
Além do modo local (stdio), o servidor pode ser executado como um **MCP remoto**
|
|
131
|
+
via Streamable HTTP, expondo o endpoint `/mcp`. Instale com o extra `server`:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
pip install 'sqlserver-mcp-tools[server]'
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Inicie o servidor:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
MSSQL_CONNECTION_STRING="DRIVER={ODBC Driver 18 for SQL Server};SERVER=...;DATABASE=...;UID=...;PWD=...;TrustServerCertificate=yes" \
|
|
141
|
+
mcp-sqlserver-http
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Opcionalmente, ajuste host/porta com `MCP_HOST` (padrão `0.0.0.0`) e `MCP_PORT`
|
|
145
|
+
(padrão `8090`). O endpoint MCP fica em `http://<host>:<porta>/mcp`.
|
|
146
|
+
|
|
147
|
+
Para consumir remotamente no opencode:
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"mcp": {
|
|
152
|
+
"sqlserver": {
|
|
153
|
+
"type": "remote",
|
|
154
|
+
"url": "http://10.177.51.228:8090/mcp"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
128
160
|
## Ferramentas disponíveis
|
|
129
161
|
|
|
130
162
|
Somente leitura (sempre disponíveis):
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "sqlserver-mcp-tools"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.3"
|
|
8
8
|
description = "Servidor MCP (Model Context Protocol) para SQL Server com controle de permissões e modo somente-leitura"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -29,12 +29,19 @@ dependencies = [
|
|
|
29
29
|
"python-dotenv>=1.0.0",
|
|
30
30
|
]
|
|
31
31
|
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
server = [
|
|
34
|
+
"uvicorn>=0.30.0",
|
|
35
|
+
"starlette>=0.37.0",
|
|
36
|
+
]
|
|
37
|
+
|
|
32
38
|
[project.urls]
|
|
33
39
|
Repository = "https://github.com/hlgurgel/mcp-sqlserver"
|
|
34
40
|
Issues = "https://github.com/hlgurgel/mcp-sqlserver/issues"
|
|
35
41
|
|
|
36
42
|
[project.scripts]
|
|
37
43
|
mcp-sqlserver = "mcp_sqlserver.server:main"
|
|
44
|
+
mcp-sqlserver-http = "mcp_sqlserver.http_server:main"
|
|
38
45
|
|
|
39
46
|
[tool.setuptools.packages.find]
|
|
40
47
|
where = ["src"]
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""Servidor HTTP (Streamable HTTP) do mcp-sqlserver.
|
|
2
|
+
|
|
3
|
+
Expoe as ferramentas do mcp-sqlserver via HTTP no endpoint ``/mcp``, usando o
|
|
4
|
+
transporte Streamable HTTP do MCP (o padrao moderno, substituindo o SSE).
|
|
5
|
+
|
|
6
|
+
Requer o extra ``server`` (uvicorn + starlette):
|
|
7
|
+
|
|
8
|
+
pip install 'sqlserver-mcp-tools[server]'
|
|
9
|
+
|
|
10
|
+
Variaveis de ambiente opcionais:
|
|
11
|
+
|
|
12
|
+
- ``MCP_HOST``: host de escuta (padrao ``0.0.0.0``)
|
|
13
|
+
- ``MCP_PORT``: porta de escuta (padrao ``8090``)
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
import os
|
|
17
|
+
|
|
18
|
+
from mcp.server.streamable_http_manager import StreamableHTTPSessionManager
|
|
19
|
+
|
|
20
|
+
from .server import servidor
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class _StreamableHTTPASGIApp:
|
|
24
|
+
"""Wrapper ASGI para o handler do session manager.
|
|
25
|
+
|
|
26
|
+
O Starlette trata funcao/metodo como ``func(request)`` (default GET), mas
|
|
27
|
+
classe/instancia como ASGI app puro — necessario para o Streamable HTTP
|
|
28
|
+
aceitar POST/DELETE.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
def __init__(self, session_manager: StreamableHTTPSessionManager):
|
|
32
|
+
self.session_manager = session_manager
|
|
33
|
+
|
|
34
|
+
async def __call__(self, scope, receive, send) -> None:
|
|
35
|
+
await self.session_manager.handle_request(scope, receive, send)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def criar_app():
|
|
39
|
+
"""Monta a aplicacao Starlette com o transporte Streamable HTTP em /mcp."""
|
|
40
|
+
from starlette.applications import Starlette
|
|
41
|
+
from starlette.routing import Route
|
|
42
|
+
|
|
43
|
+
session_manager = StreamableHTTPSessionManager(app=servidor)
|
|
44
|
+
|
|
45
|
+
return Starlette(
|
|
46
|
+
routes=[Route("/mcp", endpoint=_StreamableHTTPASGIApp(session_manager))],
|
|
47
|
+
lifespan=lambda app: session_manager.run(),
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def main():
|
|
52
|
+
try:
|
|
53
|
+
import uvicorn
|
|
54
|
+
except ImportError as e:
|
|
55
|
+
raise SystemExit(
|
|
56
|
+
"O modo HTTP requer o extra 'server'. Instale com: "
|
|
57
|
+
"pip install 'sqlserver-mcp-tools[server]'"
|
|
58
|
+
) from e
|
|
59
|
+
|
|
60
|
+
host = os.getenv("MCP_HOST", "0.0.0.0")
|
|
61
|
+
port = int(os.getenv("MCP_PORT", "8090"))
|
|
62
|
+
uvicorn.run(criar_app(), host=host, port=port, log_level="info")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
if __name__ == "__main__":
|
|
66
|
+
main()
|
{sqlserver_mcp_tools-0.1.2 → sqlserver_mcp_tools-0.1.3}/src/sqlserver_mcp_tools.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sqlserver-mcp-tools
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: Servidor MCP (Model Context Protocol) para SQL Server com controle de permissões e modo somente-leitura
|
|
5
5
|
Author: hlgurgel
|
|
6
6
|
License-Expression: MIT
|
|
@@ -21,6 +21,9 @@ License-File: LICENSE
|
|
|
21
21
|
Requires-Dist: mcp<2.0,>=1.0.0
|
|
22
22
|
Requires-Dist: pyodbc>=5.0.0
|
|
23
23
|
Requires-Dist: python-dotenv>=1.0.0
|
|
24
|
+
Provides-Extra: server
|
|
25
|
+
Requires-Dist: uvicorn>=0.30.0; extra == "server"
|
|
26
|
+
Requires-Dist: starlette>=0.37.0; extra == "server"
|
|
24
27
|
Dynamic: license-file
|
|
25
28
|
|
|
26
29
|
# mcp-sqlserver
|
|
@@ -150,6 +153,38 @@ Alternativa: apontar para um arquivo `.env` local, mantendo a senha fora do JSON
|
|
|
150
153
|
}
|
|
151
154
|
```
|
|
152
155
|
|
|
156
|
+
## Servidor HTTP (Streamable HTTP)
|
|
157
|
+
|
|
158
|
+
Além do modo local (stdio), o servidor pode ser executado como um **MCP remoto**
|
|
159
|
+
via Streamable HTTP, expondo o endpoint `/mcp`. Instale com o extra `server`:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
pip install 'sqlserver-mcp-tools[server]'
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Inicie o servidor:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
MSSQL_CONNECTION_STRING="DRIVER={ODBC Driver 18 for SQL Server};SERVER=...;DATABASE=...;UID=...;PWD=...;TrustServerCertificate=yes" \
|
|
169
|
+
mcp-sqlserver-http
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Opcionalmente, ajuste host/porta com `MCP_HOST` (padrão `0.0.0.0`) e `MCP_PORT`
|
|
173
|
+
(padrão `8090`). O endpoint MCP fica em `http://<host>:<porta>/mcp`.
|
|
174
|
+
|
|
175
|
+
Para consumir remotamente no opencode:
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"mcp": {
|
|
180
|
+
"sqlserver": {
|
|
181
|
+
"type": "remote",
|
|
182
|
+
"url": "http://10.177.51.228:8090/mcp"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
153
188
|
## Ferramentas disponíveis
|
|
154
189
|
|
|
155
190
|
Somente leitura (sempre disponíveis):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|