sql-mcp 2.3.4__tar.gz → 2.3.5__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.
- {sql_mcp-2.3.4/sql_mcp.egg-info → sql_mcp-2.3.5}/PKG-INFO +4 -6
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/pyproject.toml +15 -14
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/__init__.py +17 -1
- sql_mcp-2.3.5/sql_mcp/__main__.py +4 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/api_client.py +0 -2
- sql_mcp-2.3.5/sql_mcp/connector_sources.py +75 -0
- sql_mcp-2.3.5/sql_mcp/mcp_server.py +17 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/ontology/certification.json +4 -4
- {sql_mcp-2.3.4 → sql_mcp-2.3.5/sql_mcp.egg-info}/PKG-INFO +4 -6
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp.egg-info/SOURCES.txt +1 -8
- sql_mcp-2.3.5/sql_mcp.egg-info/entry_points.txt +8 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp.egg-info/requires.txt +2 -5
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/tests/test_api_wrapper.py +2 -2
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/tests/test_auth.py +5 -5
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/tests/test_dialect_paths.py +4 -4
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/tests/test_startup.py +4 -22
- sql_mcp-2.3.4/MANIFEST.in +0 -4
- sql_mcp-2.3.4/requirements.txt +0 -3
- sql_mcp-2.3.4/sql_mcp/__main__.py +0 -4
- sql_mcp-2.3.4/sql_mcp/connector_sources.py +0 -121
- sql_mcp-2.3.4/sql_mcp/connectors/__init__.py +0 -0
- sql_mcp-2.3.4/sql_mcp/mcp_server.py +0 -69
- sql_mcp-2.3.4/sql_mcp/prompts/__init__.py +0 -0
- sql_mcp-2.3.4/sql_mcp/skills/__init__.py +0 -0
- sql_mcp-2.3.4/sql_mcp.egg-info/entry_points.txt +0 -14
- sql_mcp-2.3.4/tests/test_default_content_surfaces.py +0 -43
- sql_mcp-2.3.4/tests/test_verify_api_integration.py +0 -266
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/LICENSE +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/README.md +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/setup.cfg +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/api/__init__.py +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/api/api_client_sql.py +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/auth.py +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/dialects.py +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/kg_ingest.py +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/kg_pgwire.py +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/mcp/__init__.py +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/mcp/mcp_sql.py +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/mcp_config.json +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/ontology/__init__.py +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/ontology/database.ttl +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/ontology/fixtures/records.json +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/ontology/mappings/source.yaml +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/ontology/migrations/manifest.json +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/ontology/shapes/connector.shacl.ttl +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/prompts/database_specialist.json +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/safety.py +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/skills/sql-mcp-knowledge-graph-ingestion/SKILL.md +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/skills/sql-mcp-knowledge-graph-ingestion/WORKFLOW.md +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/skills/sql-mcp-operations/SKILL.md +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/skills/sql-mcp-operations/agents/openai.yaml +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/skills/sql-mcp-operations/references/catalog.md +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/skills/sql-mcp-query-execution/SKILL.md +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/skills/sql-mcp-query-execution/WORKFLOW.md +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/skills/sql-mcp-schema-inspection/SKILL.md +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/skills/sql-mcp-schema-inspection/WORKFLOW.md +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/sql_input_models.py +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/sql_response_models.py +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp.egg-info/dependency_links.txt +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp.egg-info/top_level.txt +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/tests/test_dialects.py +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/tests/test_identity_context_scoping.py +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/tests/test_init_dynamics.py +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/tests/test_kg_ingest.py +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/tests/test_kg_pgwire.py +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/tests/test_package_getattr.py +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/tests/test_safety.py +0 -0
- {sql_mcp-2.3.4 → sql_mcp-2.3.5}/tests/test_sql_mcp_validation.py +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sql-mcp
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.5
|
|
4
4
|
Summary: Generic SQL database (Postgres, MySQL/MariaDB, MSSQL, Oracle, SQLite) API + MCP Server for Agentic AI!
|
|
5
|
-
Author-email:
|
|
5
|
+
Author-email: Repository Maintainers <maintainers@knuckles.team>
|
|
6
6
|
License: MIT
|
|
7
7
|
Classifier: Development Status :: 4 - Beta
|
|
8
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -12,11 +12,9 @@ Classifier: Programming Language :: Python :: 3
|
|
|
12
12
|
Requires-Python: <3.15,>=3.12
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist: agent-connector-sdk[mcp]<
|
|
15
|
+
Requires-Dist: agent-connector-sdk[mcp]<0.6.0,>=0.5.4
|
|
16
16
|
Requires-Dist: python-dotenv>=1.2.4
|
|
17
17
|
Requires-Dist: sqlalchemy>=2.1.5
|
|
18
|
-
Provides-Extra: mcp
|
|
19
|
-
Requires-Dist: agent-connector-sdk[mcp]<1.0.0,>=0.4.1; extra == "mcp"
|
|
20
18
|
Provides-Extra: postgres
|
|
21
19
|
Requires-Dist: psycopg[binary]>=3.3.6; extra == "postgres"
|
|
22
20
|
Provides-Extra: mysql
|
|
@@ -26,7 +24,7 @@ Requires-Dist: pyodbc>=5.3.0; extra == "mssql"
|
|
|
26
24
|
Provides-Extra: oracle
|
|
27
25
|
Requires-Dist: oracledb>=26.0.1; extra == "oracle"
|
|
28
26
|
Provides-Extra: all
|
|
29
|
-
Requires-Dist: sql-mcp[
|
|
27
|
+
Requires-Dist: sql-mcp[mssql,mysql,oracle,postgres]>=1.0.0; extra == "all"
|
|
30
28
|
Provides-Extra: test
|
|
31
29
|
Requires-Dist: pytest-xdist>=3.8.0; extra == "test"
|
|
32
30
|
Requires-Dist: pytest>=9.1.1; extra == "test"
|
|
@@ -4,43 +4,36 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "sql-mcp"
|
|
7
|
-
version = "2.3.
|
|
7
|
+
version = "2.3.5"
|
|
8
8
|
description = "Generic SQL database (Postgres, MySQL/MariaDB, MSSQL, Oracle, SQLite) API + MCP Server for Agentic AI!"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
classifiers = [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Environment :: Console", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3",]
|
|
11
11
|
requires-python = ">=3.12, <3.15"
|
|
12
|
-
dependencies = [ "agent-connector-sdk[mcp]>=0.4
|
|
12
|
+
dependencies = [ "agent-connector-sdk[mcp]>=0.5.4,<0.6.0", "python-dotenv>=1.2.4", "sqlalchemy>=2.1.5",]
|
|
13
13
|
[[project.authors]]
|
|
14
|
-
name = "
|
|
15
|
-
email = "maintainers@
|
|
14
|
+
name = "Repository Maintainers"
|
|
15
|
+
email = "maintainers@knuckles.team"
|
|
16
16
|
|
|
17
17
|
[project.license]
|
|
18
18
|
text = "MIT"
|
|
19
19
|
|
|
20
20
|
[project.optional-dependencies]
|
|
21
|
-
mcp = [ "agent-connector-sdk[mcp]>=0.4.1,<1.0.0",]
|
|
22
21
|
postgres = [ "psycopg[binary]>=3.3.6",]
|
|
23
22
|
mysql = [ "pymysql>=1.2.3",]
|
|
24
23
|
mssql = [ "pyodbc>=5.3.0",]
|
|
25
24
|
oracle = [ "oracledb>=26.0.1",]
|
|
26
|
-
all = [ "sql-mcp[
|
|
25
|
+
all = [ "sql-mcp[postgres,mysql,mssql,oracle]>=1.0.0",]
|
|
27
26
|
test = [ "pytest-xdist>=3.8.0", "pytest>=9.1.1", "pytest-asyncio>=1.4.0", "pytest-cov>=7.1.0",]
|
|
28
27
|
|
|
29
28
|
[project.scripts]
|
|
30
|
-
sql-mcp = "
|
|
31
|
-
|
|
32
|
-
[project.entry-points."agent_connector_sdk.skill_providers"]
|
|
33
|
-
sql-mcp = "sql_mcp.skills"
|
|
29
|
+
sql-mcp = "agent_connector_sdk.cli:serve"
|
|
34
30
|
|
|
35
31
|
[project.entry-points."agent_connector_sdk.prompt_providers"]
|
|
36
32
|
sql-mcp = "sql_mcp.prompts"
|
|
37
33
|
|
|
38
|
-
[project.entry-points."agent_connector_sdk.ontology_providers"]
|
|
39
|
-
sql-mcp = "sql_mcp.ontology"
|
|
40
|
-
|
|
41
34
|
# The one declared connector identity: the fleet name (SDK-CONNECTOR-CONTROL-R071).
|
|
42
35
|
[project.entry-points."agent_connector_sdk.connector"]
|
|
43
|
-
sql-mcp = "sql_mcp"
|
|
36
|
+
sql-mcp = "sql_mcp:connector"
|
|
44
37
|
|
|
45
38
|
[tool.uv.workspace]
|
|
46
39
|
members = ["."]
|
|
@@ -55,6 +48,7 @@ override-dependencies = [
|
|
|
55
48
|
|
|
56
49
|
|
|
57
50
|
[tool.ruff]
|
|
51
|
+
extend-exclude = ["tests", "scripts"]
|
|
58
52
|
line-length = 88
|
|
59
53
|
target-version = "py312"
|
|
60
54
|
|
|
@@ -82,3 +76,10 @@ include = [ "sql_mcp*",]
|
|
|
82
76
|
|
|
83
77
|
[tool.pipelines_hooks.ste]
|
|
84
78
|
exempt = ["specs/*", "specs/**/*"]
|
|
79
|
+
|
|
80
|
+
[tool.pipelines.container]
|
|
81
|
+
debug_apt = ["default-jre", "ripgrep", "tree", "fd-find", "curl", "nano", "build-essential", "cmake", "libssl-dev", "libcurl4-openssl-dev", "pkg-config", "cargo", "rustc"]
|
|
82
|
+
install_extras = {"mcp" = []}
|
|
83
|
+
|
|
84
|
+
[tool.pipelines.codespell]
|
|
85
|
+
ignore_words = ["hasTable"]
|
|
@@ -4,7 +4,6 @@ import importlib
|
|
|
4
4
|
import inspect
|
|
5
5
|
from typing import Any
|
|
6
6
|
|
|
7
|
-
__version__ = "0.1.0"
|
|
8
7
|
__all__: list[str] = []
|
|
9
8
|
|
|
10
9
|
CORE_MODULES = ["sql_mcp.api_client"]
|
|
@@ -69,3 +68,20 @@ def __getattr__(name: str) -> Any:
|
|
|
69
68
|
|
|
70
69
|
def __dir__() -> list[str]:
|
|
71
70
|
return sorted(list(globals().keys()) + __all__)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
from agent_connector_sdk.connector import Connector
|
|
74
|
+
|
|
75
|
+
from sql_mcp.api_client import Api
|
|
76
|
+
from sql_mcp.auth import get_api
|
|
77
|
+
from sql_mcp.mcp_server import readiness
|
|
78
|
+
|
|
79
|
+
connector = Connector(
|
|
80
|
+
api=Api,
|
|
81
|
+
get_client=get_api,
|
|
82
|
+
tools="sql_mcp.mcp_server",
|
|
83
|
+
instructions="Generic SQL database MCP Server - read-only queries, gated DML/DDL, schema reflection, and connection admin over SQLAlchemy 2.x Core (SQLite, Postgres, MySQL/MariaDB, MSSQL, Oracle) with named multi-connection support.",
|
|
84
|
+
readiness=readiness,
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
__all__ = ["connector"]
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""Data sources of this connector, declared by tool name (generated by connector-ontology-map migrate).
|
|
2
|
+
|
|
3
|
+
Served live as ``connector://resources``. Regenerate by editing the declarations, not the tools.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: E501
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
SOURCES: tuple[Any, ...] = ()
|
|
12
|
+
|
|
13
|
+
SCHEMA_VERSION = 2
|
|
14
|
+
|
|
15
|
+
FIELD_SETS: dict[str, dict[str, str]] = {
|
|
16
|
+
"fields_1": {
|
|
17
|
+
"dataType": "xsd:string",
|
|
18
|
+
"isForeignKey": "xsd:boolean",
|
|
19
|
+
"isNullable": "xsd:boolean",
|
|
20
|
+
"isPrimaryKey": "xsd:boolean",
|
|
21
|
+
"isUnique": "xsd:boolean",
|
|
22
|
+
"sqlDialect": "xsd:string",
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
SCHEMA_MAPPINGS: dict[str, Any] = {
|
|
27
|
+
"DatabaseColumn": {
|
|
28
|
+
"field_sets": ["fields_1"],
|
|
29
|
+
"ontology_class": "ApplicationLayer",
|
|
30
|
+
},
|
|
31
|
+
"DatabaseIndex": {
|
|
32
|
+
"field_sets": ["fields_1"],
|
|
33
|
+
"ontology_class": "ApplicationLayer",
|
|
34
|
+
},
|
|
35
|
+
"DatabaseSchema": {
|
|
36
|
+
"field_sets": ["fields_1"],
|
|
37
|
+
"ontology_class": "TechnologyLayer",
|
|
38
|
+
},
|
|
39
|
+
"DatabaseTable": {
|
|
40
|
+
"field_sets": ["fields_1"],
|
|
41
|
+
"ontology_class": "ApplicationLayer",
|
|
42
|
+
},
|
|
43
|
+
"DatabaseView": {
|
|
44
|
+
"field_sets": ["fields_1"],
|
|
45
|
+
"ontology_class": "ApplicationLayer",
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
RESOURCES: tuple[dict[str, str], ...] = (
|
|
50
|
+
{
|
|
51
|
+
"id_prefix": "databasecolumn",
|
|
52
|
+
"label": "Database Column",
|
|
53
|
+
"name": "DatabaseColumn",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"id_prefix": "databaseindex",
|
|
57
|
+
"label": "Database Index",
|
|
58
|
+
"name": "DatabaseIndex",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"id_prefix": "databaseschema",
|
|
62
|
+
"label": "Database Schema",
|
|
63
|
+
"name": "DatabaseSchema",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id_prefix": "databasetable",
|
|
67
|
+
"label": "Database Table",
|
|
68
|
+
"name": "DatabaseTable",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"id_prefix": "databaseview",
|
|
72
|
+
"label": "Database View",
|
|
73
|
+
"name": "DatabaseView",
|
|
74
|
+
},
|
|
75
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""Main FastMCP server and tool registration for sql-mcp."""
|
|
2
|
+
|
|
3
|
+
from agent_connector_sdk.connector_hooks import Readiness
|
|
4
|
+
|
|
5
|
+
from sql_mcp.auth import get_api
|
|
6
|
+
from sql_mcp.mcp.mcp_sql import register_sql_tools
|
|
7
|
+
|
|
8
|
+
# SDK discovery registers the register_<tag>_tools functions bound in this module.
|
|
9
|
+
__all__ = ["register_sql_tools"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
async def readiness() -> Readiness:
|
|
13
|
+
try:
|
|
14
|
+
get_api()
|
|
15
|
+
except Exception:
|
|
16
|
+
return Readiness(False)
|
|
17
|
+
return Readiness(True)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"api_version": "
|
|
2
|
+
"api_version": "graphos.io/v1",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"sql_mcp/ontology/database.ttl": "
|
|
4
|
+
"sql_mcp/ontology/database.ttl": "9bedb25413dbd4aa83ae76ec84b025e01f5e1affd1afc01e899e543e5ba2dbd2",
|
|
5
5
|
"sql_mcp/ontology/fixtures/records.json": "2a06e3f58c45c99a612d756419b9029fc7d14f5acaa1db77f964e32cc58c28d1",
|
|
6
6
|
"sql_mcp/ontology/mappings/source.yaml": "15faf4992ea561ea2ffa48bdd39ccb78823b11b31f32aeda2030479e700a521e",
|
|
7
7
|
"sql_mcp/ontology/migrations/manifest.json": "18189bd6a40c3683809ed9d80a2179361bbc8ea79d11ed1c3bed6152f64c3396",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"synthetic_fixture_contract": "passed"
|
|
16
16
|
},
|
|
17
17
|
"compatibility": {
|
|
18
|
-
"
|
|
18
|
+
"agent_utilities": ">=2.5.0,<3",
|
|
19
19
|
"bundle_schema": "2",
|
|
20
20
|
"epistemic_graph": ">=2.27.0,<3"
|
|
21
21
|
},
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"signer": "UNSIGNED-PREVIEW",
|
|
30
30
|
"signing_public_key": "",
|
|
31
31
|
"status": "source-validated",
|
|
32
|
-
"validated_at": "2026-
|
|
32
|
+
"validated_at": "2026-10-24T12:18:45Z"
|
|
33
33
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sql-mcp
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.5
|
|
4
4
|
Summary: Generic SQL database (Postgres, MySQL/MariaDB, MSSQL, Oracle, SQLite) API + MCP Server for Agentic AI!
|
|
5
|
-
Author-email:
|
|
5
|
+
Author-email: Repository Maintainers <maintainers@knuckles.team>
|
|
6
6
|
License: MIT
|
|
7
7
|
Classifier: Development Status :: 4 - Beta
|
|
8
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -12,11 +12,9 @@ Classifier: Programming Language :: Python :: 3
|
|
|
12
12
|
Requires-Python: <3.15,>=3.12
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist: agent-connector-sdk[mcp]<
|
|
15
|
+
Requires-Dist: agent-connector-sdk[mcp]<0.6.0,>=0.5.4
|
|
16
16
|
Requires-Dist: python-dotenv>=1.2.4
|
|
17
17
|
Requires-Dist: sqlalchemy>=2.1.5
|
|
18
|
-
Provides-Extra: mcp
|
|
19
|
-
Requires-Dist: agent-connector-sdk[mcp]<1.0.0,>=0.4.1; extra == "mcp"
|
|
20
18
|
Provides-Extra: postgres
|
|
21
19
|
Requires-Dist: psycopg[binary]>=3.3.6; extra == "postgres"
|
|
22
20
|
Provides-Extra: mysql
|
|
@@ -26,7 +24,7 @@ Requires-Dist: pyodbc>=5.3.0; extra == "mssql"
|
|
|
26
24
|
Provides-Extra: oracle
|
|
27
25
|
Requires-Dist: oracledb>=26.0.1; extra == "oracle"
|
|
28
26
|
Provides-Extra: all
|
|
29
|
-
Requires-Dist: sql-mcp[
|
|
27
|
+
Requires-Dist: sql-mcp[mssql,mysql,oracle,postgres]>=1.0.0; extra == "all"
|
|
30
28
|
Provides-Extra: test
|
|
31
29
|
Requires-Dist: pytest-xdist>=3.8.0; extra == "test"
|
|
32
30
|
Requires-Dist: pytest>=9.1.1; extra == "test"
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
LICENSE
|
|
2
|
-
MANIFEST.in
|
|
3
2
|
README.md
|
|
4
3
|
pyproject.toml
|
|
5
|
-
requirements.txt
|
|
6
4
|
sql_mcp/__init__.py
|
|
7
5
|
sql_mcp/__main__.py
|
|
8
6
|
sql_mcp/api_client.py
|
|
@@ -24,7 +22,6 @@ sql_mcp.egg-info/requires.txt
|
|
|
24
22
|
sql_mcp.egg-info/top_level.txt
|
|
25
23
|
sql_mcp/api/__init__.py
|
|
26
24
|
sql_mcp/api/api_client_sql.py
|
|
27
|
-
sql_mcp/connectors/__init__.py
|
|
28
25
|
sql_mcp/mcp/__init__.py
|
|
29
26
|
sql_mcp/mcp/mcp_sql.py
|
|
30
27
|
sql_mcp/ontology/__init__.py
|
|
@@ -34,9 +31,7 @@ sql_mcp/ontology/fixtures/records.json
|
|
|
34
31
|
sql_mcp/ontology/mappings/source.yaml
|
|
35
32
|
sql_mcp/ontology/migrations/manifest.json
|
|
36
33
|
sql_mcp/ontology/shapes/connector.shacl.ttl
|
|
37
|
-
sql_mcp/prompts/__init__.py
|
|
38
34
|
sql_mcp/prompts/database_specialist.json
|
|
39
|
-
sql_mcp/skills/__init__.py
|
|
40
35
|
sql_mcp/skills/sql-mcp-knowledge-graph-ingestion/SKILL.md
|
|
41
36
|
sql_mcp/skills/sql-mcp-knowledge-graph-ingestion/WORKFLOW.md
|
|
42
37
|
sql_mcp/skills/sql-mcp-operations/SKILL.md
|
|
@@ -48,7 +43,6 @@ sql_mcp/skills/sql-mcp-schema-inspection/SKILL.md
|
|
|
48
43
|
sql_mcp/skills/sql-mcp-schema-inspection/WORKFLOW.md
|
|
49
44
|
tests/test_api_wrapper.py
|
|
50
45
|
tests/test_auth.py
|
|
51
|
-
tests/test_default_content_surfaces.py
|
|
52
46
|
tests/test_dialect_paths.py
|
|
53
47
|
tests/test_dialects.py
|
|
54
48
|
tests/test_identity_context_scoping.py
|
|
@@ -58,5 +52,4 @@ tests/test_kg_pgwire.py
|
|
|
58
52
|
tests/test_package_getattr.py
|
|
59
53
|
tests/test_safety.py
|
|
60
54
|
tests/test_sql_mcp_validation.py
|
|
61
|
-
tests/test_startup.py
|
|
62
|
-
tests/test_verify_api_integration.py
|
|
55
|
+
tests/test_startup.py
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
agent-connector-sdk[mcp]<
|
|
1
|
+
agent-connector-sdk[mcp]<0.6.0,>=0.5.4
|
|
2
2
|
python-dotenv>=1.2.4
|
|
3
3
|
sqlalchemy>=2.1.5
|
|
4
4
|
|
|
5
5
|
[all]
|
|
6
|
-
sql-mcp[
|
|
7
|
-
|
|
8
|
-
[mcp]
|
|
9
|
-
agent-connector-sdk[mcp]<1.0.0,>=0.4.1
|
|
6
|
+
sql-mcp[mssql,mysql,oracle,postgres]>=1.0.0
|
|
10
7
|
|
|
11
8
|
[mssql]
|
|
12
9
|
pyodbc>=5.3.0
|
|
@@ -325,8 +325,8 @@ def test_batch_and_script_limits_are_enforced():
|
|
|
325
325
|
@pytest.mark.parametrize(
|
|
326
326
|
"url",
|
|
327
327
|
[
|
|
328
|
-
"mysql+pymysql://svc:
|
|
329
|
-
"oracle+oracledb://svc:
|
|
328
|
+
"mysql+pymysql://svc:password@db/app",
|
|
329
|
+
"oracle+oracledb://svc:password@db/app",
|
|
330
330
|
],
|
|
331
331
|
)
|
|
332
332
|
def test_implicit_commit_dialects_reject_multi_statement_ddl_scripts(url):
|
|
@@ -196,11 +196,11 @@ def test_get_api_caches_until_reset(monkeypatch):
|
|
|
196
196
|
def test_passwords_redacted_in_connection_descriptions(monkeypatch):
|
|
197
197
|
monkeypatch.setenv(
|
|
198
198
|
"SQL_CONNECTIONS",
|
|
199
|
-
json.dumps({"dw": "postgresql+psycopg://bob:
|
|
199
|
+
json.dumps({"dw": "postgresql+psycopg://bob:placeholder@db:5432/dw"}),
|
|
200
200
|
)
|
|
201
201
|
api = auth.get_api()
|
|
202
202
|
described = api.describe_connections()
|
|
203
|
-
assert "
|
|
203
|
+
assert "placeholder" not in json.dumps(described)
|
|
204
204
|
assert "***" in described[0]["url"]
|
|
205
205
|
|
|
206
206
|
|
|
@@ -210,7 +210,7 @@ def test_url_query_secrets_are_redacted_in_connection_descriptions(monkeypatch):
|
|
|
210
210
|
json.dumps(
|
|
211
211
|
{
|
|
212
212
|
"dw": (
|
|
213
|
-
"postgresql+psycopg://bob:
|
|
213
|
+
"postgresql+psycopg://bob:password@db:5432/dw?"
|
|
214
214
|
"sslmode=require&access_token=query-secret&sslpassword=tls-secret"
|
|
215
215
|
)
|
|
216
216
|
}
|
|
@@ -242,12 +242,12 @@ def test_odbc_connect_query_is_fully_redacted(monkeypatch):
|
|
|
242
242
|
def test_passwords_never_in_logs(monkeypatch, caplog):
|
|
243
243
|
monkeypatch.setenv(
|
|
244
244
|
"SQL_CONNECTIONS",
|
|
245
|
-
json.dumps({"dw": "postgresql+psycopg://bob:
|
|
245
|
+
json.dumps({"dw": "postgresql+psycopg://bob:placeholder@db:5432/dw"}),
|
|
246
246
|
)
|
|
247
247
|
with caplog.at_level("DEBUG"):
|
|
248
248
|
auth.load_connections()
|
|
249
249
|
auth.get_api()
|
|
250
|
-
assert "
|
|
250
|
+
assert "placeholder" not in caplog.text
|
|
251
251
|
|
|
252
252
|
|
|
253
253
|
# --------------------------------------------------------------------- #
|
|
@@ -26,7 +26,7 @@ def fake_engine(result):
|
|
|
26
26
|
@pytest.fixture
|
|
27
27
|
def pg_api():
|
|
28
28
|
client = Api(
|
|
29
|
-
connections={"pg": "postgresql+psycopg://svc:
|
|
29
|
+
connections={"pg": "postgresql+psycopg://svc:password@db:5432/app"},
|
|
30
30
|
allow_writes=False,
|
|
31
31
|
max_rows=50,
|
|
32
32
|
timeout=5.0,
|
|
@@ -37,7 +37,7 @@ def pg_api():
|
|
|
37
37
|
|
|
38
38
|
def test_explain_unsupported_for_mssql():
|
|
39
39
|
client = Api(
|
|
40
|
-
connections={"mart": "mssql+pyodbc://svc:
|
|
40
|
+
connections={"mart": "mssql+pyodbc://svc:password@db:1433/mart"},
|
|
41
41
|
allow_writes=False,
|
|
42
42
|
max_rows=50,
|
|
43
43
|
timeout=5.0,
|
|
@@ -51,7 +51,7 @@ def test_explain_unsupported_for_mssql():
|
|
|
51
51
|
|
|
52
52
|
def test_explain_unsupported_for_oracle():
|
|
53
53
|
client = Api(
|
|
54
|
-
connections={"oracle": "oracle+oracledb://svc:
|
|
54
|
+
connections={"oracle": "oracle+oracledb://svc:password@db:1521/app"},
|
|
55
55
|
allow_writes=False,
|
|
56
56
|
max_rows=50,
|
|
57
57
|
timeout=5.0,
|
|
@@ -158,7 +158,7 @@ def test_engine_creation_requires_driver(pg_api):
|
|
|
158
158
|
|
|
159
159
|
def test_unregistered_dialect_reports_no_session_view():
|
|
160
160
|
client = Api(
|
|
161
|
-
connections={"fb": "firebird://svc:
|
|
161
|
+
connections={"fb": "firebird://svc:password@db/x"},
|
|
162
162
|
allow_writes=False,
|
|
163
163
|
max_rows=50,
|
|
164
164
|
timeout=5.0,
|
|
@@ -9,7 +9,7 @@ pytest.importorskip("agent_connector_sdk.mcp.action_dispatch")
|
|
|
9
9
|
from fastmcp import Client # noqa: E402
|
|
10
10
|
|
|
11
11
|
from sql_mcp import auth # noqa: E402
|
|
12
|
-
from
|
|
12
|
+
from agent_connector_sdk.connector import build_server # noqa: E402
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
async def list_tool_names(mcp) -> set[str]:
|
|
@@ -20,7 +20,7 @@ async def list_tool_names(mcp) -> set[str]:
|
|
|
20
20
|
async def test_get_mcp_instance_registers_sql_tools(monkeypatch):
|
|
21
21
|
monkeypatch.setenv("SQL_URL", "sqlite+pysqlite:///:memory:")
|
|
22
22
|
monkeypatch.setattr("sys.argv", ["sql-mcp"])
|
|
23
|
-
|
|
23
|
+
_, mcp = build_server("sql_mcp", command_args=[])
|
|
24
24
|
names = await list_tool_names(mcp)
|
|
25
25
|
assert {"sql_query", "sql_execute", "sql_ingest_schema"} <= names
|
|
26
26
|
assert not {"sql_schema", "sql_admin"} & names
|
|
@@ -29,7 +29,7 @@ async def test_get_mcp_instance_registers_sql_tools(monkeypatch):
|
|
|
29
29
|
async def test_sqltool_flag_disables_registration(monkeypatch):
|
|
30
30
|
monkeypatch.setenv("SQLTOOL", "False")
|
|
31
31
|
monkeypatch.setattr("sys.argv", ["sql-mcp"])
|
|
32
|
-
|
|
32
|
+
_, mcp = build_server("sql_mcp", command_args=[])
|
|
33
33
|
assert "sql_ingest_schema" not in await list_tool_names(mcp)
|
|
34
34
|
|
|
35
35
|
|
|
@@ -37,7 +37,7 @@ async def test_operational_routes_expose_status_only(monkeypatch):
|
|
|
37
37
|
monkeypatch.setenv("SQL_URL", "sqlite+pysqlite:///:memory:")
|
|
38
38
|
monkeypatch.setattr("sys.argv", ["sql-mcp"])
|
|
39
39
|
auth.reset_api()
|
|
40
|
-
|
|
40
|
+
_, mcp = build_server("sql_mcp", command_args=[])
|
|
41
41
|
routes = {
|
|
42
42
|
route.path: route.endpoint
|
|
43
43
|
for route in mcp._additional_http_routes
|
|
@@ -52,21 +52,3 @@ async def test_operational_routes_expose_status_only(monkeypatch):
|
|
|
52
52
|
assert ready.status_code == 200
|
|
53
53
|
assert json.loads(ready.body) == {"status": "ready"}
|
|
54
54
|
auth.reset_api()
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
async def test_readiness_fails_closed_without_details(monkeypatch):
|
|
58
|
-
monkeypatch.setattr("sys.argv", ["sql-mcp"])
|
|
59
|
-
monkeypatch.setattr(
|
|
60
|
-
"sql_mcp.mcp_server.get_api",
|
|
61
|
-
lambda: (_ for _ in ()).throw(RuntimeError("private failure detail")),
|
|
62
|
-
)
|
|
63
|
-
mcp, _, _ = get_mcp_instance()
|
|
64
|
-
endpoint = next(
|
|
65
|
-
route.endpoint for route in mcp._additional_http_routes if route.path == "/ready"
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
response = await endpoint(None)
|
|
69
|
-
|
|
70
|
-
assert response.status_code == 503
|
|
71
|
-
assert json.loads(response.body) == {"status": "unavailable"}
|
|
72
|
-
assert b"private failure detail" not in response.body
|
sql_mcp-2.3.4/MANIFEST.in
DELETED
sql_mcp-2.3.4/requirements.txt
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"""Data sources of this connector, declared by tool name (generated by connector-ontology-map migrate).
|
|
2
|
-
|
|
3
|
-
Served live as ``connector://resources``. Regenerate by editing the declarations, not the tools.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
# ruff: noqa: E501
|
|
7
|
-
from __future__ import annotations
|
|
8
|
-
|
|
9
|
-
from typing import Any
|
|
10
|
-
|
|
11
|
-
from agent_connector_sdk.ingest.sources import IngestSourceDeclaration, IngestSourceSpec
|
|
12
|
-
|
|
13
|
-
CONNECTOR: str = "sql-mcp"
|
|
14
|
-
|
|
15
|
-
SOURCES: tuple[Any, ...] = ()
|
|
16
|
-
|
|
17
|
-
SCHEMA_MAPPINGS: dict[str, Any] = {
|
|
18
|
-
"DatabaseColumn": {
|
|
19
|
-
"fields": {
|
|
20
|
-
"dataType": "xsd:string",
|
|
21
|
-
"isForeignKey": "xsd:boolean",
|
|
22
|
-
"isNullable": "xsd:boolean",
|
|
23
|
-
"isPrimaryKey": "xsd:boolean",
|
|
24
|
-
"isUnique": "xsd:boolean",
|
|
25
|
-
"sqlDialect": "xsd:string",
|
|
26
|
-
},
|
|
27
|
-
"ontology_class": "ApplicationLayer",
|
|
28
|
-
},
|
|
29
|
-
"DatabaseIndex": {
|
|
30
|
-
"fields": {
|
|
31
|
-
"dataType": "xsd:string",
|
|
32
|
-
"isForeignKey": "xsd:boolean",
|
|
33
|
-
"isNullable": "xsd:boolean",
|
|
34
|
-
"isPrimaryKey": "xsd:boolean",
|
|
35
|
-
"isUnique": "xsd:boolean",
|
|
36
|
-
"sqlDialect": "xsd:string",
|
|
37
|
-
},
|
|
38
|
-
"ontology_class": "ApplicationLayer",
|
|
39
|
-
},
|
|
40
|
-
"DatabaseSchema": {
|
|
41
|
-
"fields": {
|
|
42
|
-
"dataType": "xsd:string",
|
|
43
|
-
"isForeignKey": "xsd:boolean",
|
|
44
|
-
"isNullable": "xsd:boolean",
|
|
45
|
-
"isPrimaryKey": "xsd:boolean",
|
|
46
|
-
"isUnique": "xsd:boolean",
|
|
47
|
-
"sqlDialect": "xsd:string",
|
|
48
|
-
},
|
|
49
|
-
"ontology_class": "TechnologyLayer",
|
|
50
|
-
},
|
|
51
|
-
"DatabaseTable": {
|
|
52
|
-
"fields": {
|
|
53
|
-
"dataType": "xsd:string",
|
|
54
|
-
"isForeignKey": "xsd:boolean",
|
|
55
|
-
"isNullable": "xsd:boolean",
|
|
56
|
-
"isPrimaryKey": "xsd:boolean",
|
|
57
|
-
"isUnique": "xsd:boolean",
|
|
58
|
-
"sqlDialect": "xsd:string",
|
|
59
|
-
},
|
|
60
|
-
"ontology_class": "ApplicationLayer",
|
|
61
|
-
},
|
|
62
|
-
"DatabaseView": {
|
|
63
|
-
"fields": {
|
|
64
|
-
"dataType": "xsd:string",
|
|
65
|
-
"isForeignKey": "xsd:boolean",
|
|
66
|
-
"isNullable": "xsd:boolean",
|
|
67
|
-
"isPrimaryKey": "xsd:boolean",
|
|
68
|
-
"isUnique": "xsd:boolean",
|
|
69
|
-
"sqlDialect": "xsd:string",
|
|
70
|
-
},
|
|
71
|
-
"ontology_class": "ApplicationLayer",
|
|
72
|
-
},
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
RESOURCES: tuple[dict[str, str], ...] = (
|
|
76
|
-
{
|
|
77
|
-
"id_prefix": "databasecolumn",
|
|
78
|
-
"label": "Database Column",
|
|
79
|
-
"name": "DatabaseColumn",
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"id_prefix": "databaseindex",
|
|
83
|
-
"label": "Database Index",
|
|
84
|
-
"name": "DatabaseIndex",
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"id_prefix": "databaseschema",
|
|
88
|
-
"label": "Database Schema",
|
|
89
|
-
"name": "DatabaseSchema",
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"id_prefix": "databasetable",
|
|
93
|
-
"label": "Database Table",
|
|
94
|
-
"name": "DatabaseTable",
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
"id_prefix": "databaseview",
|
|
98
|
-
"label": "Database View",
|
|
99
|
-
"name": "DatabaseView",
|
|
100
|
-
},
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
def declaration() -> IngestSourceDeclaration:
|
|
105
|
-
"""The declaration the server assembles from this module."""
|
|
106
|
-
specs: list[IngestSourceSpec] = []
|
|
107
|
-
for item in SOURCES:
|
|
108
|
-
for entry in item["connector_sources"]:
|
|
109
|
-
body: dict[str, Any] = {
|
|
110
|
-
k: v for k, v in entry.items() if k not in ("tool", "mapping")
|
|
111
|
-
}
|
|
112
|
-
spec = {**body, "tools": (entry["tool"],)}
|
|
113
|
-
specs.append(IngestSourceSpec.model_validate(spec))
|
|
114
|
-
return IngestSourceDeclaration.model_validate(
|
|
115
|
-
{
|
|
116
|
-
"connector": CONNECTOR,
|
|
117
|
-
"sources": specs,
|
|
118
|
-
"schema_mappings": SCHEMA_MAPPINGS,
|
|
119
|
-
"resources": RESOURCES,
|
|
120
|
-
}
|
|
121
|
-
)
|
|
File without changes
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"""Main FastMCP server and tool registration for sql-mcp."""
|
|
2
|
-
|
|
3
|
-
import sys
|
|
4
|
-
from typing import Any
|
|
5
|
-
|
|
6
|
-
from agent_connector_sdk.config import load_config
|
|
7
|
-
from agent_connector_sdk.mcp.server import create_mcp_server
|
|
8
|
-
from agent_connector_sdk.mcp.tool_surface import register_tool_surface
|
|
9
|
-
from fastmcp.utilities.logging import get_logger
|
|
10
|
-
from starlette.requests import Request
|
|
11
|
-
from starlette.responses import JSONResponse
|
|
12
|
-
|
|
13
|
-
from sql_mcp.api_client import Api
|
|
14
|
-
from sql_mcp.auth import get_api
|
|
15
|
-
from sql_mcp.mcp.mcp_sql import register_sql_tools
|
|
16
|
-
|
|
17
|
-
__version__ = "2.3.4"
|
|
18
|
-
logger = get_logger(name="sql_mcp")
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def get_mcp_instance() -> tuple[Any, ...]:
|
|
22
|
-
load_config()
|
|
23
|
-
args, mcp, middlewares = create_mcp_server(
|
|
24
|
-
name="SQL MCP",
|
|
25
|
-
version=__version__,
|
|
26
|
-
instructions=(
|
|
27
|
-
"Generic SQL database MCP Server - read-only queries, gated "
|
|
28
|
-
"DML/DDL, schema reflection, and connection admin over "
|
|
29
|
-
"SQLAlchemy 2.x Core (SQLite, Postgres, MySQL/MariaDB, MSSQL, "
|
|
30
|
-
"Oracle) with named multi-connection support."
|
|
31
|
-
),
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
@mcp.custom_route("/ready", methods=["GET"])
|
|
35
|
-
async def readiness_check(request: Request) -> JSONResponse:
|
|
36
|
-
try:
|
|
37
|
-
get_api()
|
|
38
|
-
except Exception:
|
|
39
|
-
return JSONResponse({"status": "unavailable"}, status_code=503)
|
|
40
|
-
return JSONResponse({"status": "ready"})
|
|
41
|
-
|
|
42
|
-
register_tool_surface(
|
|
43
|
-
mcp,
|
|
44
|
-
client_cls=Api,
|
|
45
|
-
get_client=get_api,
|
|
46
|
-
service="sql-mcp",
|
|
47
|
-
registrars=[register_sql_tools],
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
for mw in middlewares:
|
|
51
|
-
mcp.add_middleware(mw)
|
|
52
|
-
return mcp, args, middlewares
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def mcp_server() -> None:
|
|
56
|
-
mcp, args, middlewares = get_mcp_instance()
|
|
57
|
-
print(f"SQL MCP v{__version__}", file=sys.stderr)
|
|
58
|
-
if args.transport == "stdio":
|
|
59
|
-
mcp.run(transport="stdio")
|
|
60
|
-
elif args.transport == "streamable-http":
|
|
61
|
-
mcp.run(transport="streamable-http", host=args.host, port=args.port)
|
|
62
|
-
elif args.transport == "sse":
|
|
63
|
-
mcp.run(transport="sse", host=args.host, port=args.port)
|
|
64
|
-
else:
|
|
65
|
-
mcp.run(transport="stdio")
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if __name__ == "__main__":
|
|
69
|
-
mcp_server()
|
|
File without changes
|
|
File without changes
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
[agent_connector_sdk.connector]
|
|
2
|
-
sql-mcp = sql_mcp
|
|
3
|
-
|
|
4
|
-
[agent_connector_sdk.ontology_providers]
|
|
5
|
-
sql-mcp = sql_mcp.ontology
|
|
6
|
-
|
|
7
|
-
[agent_connector_sdk.prompt_providers]
|
|
8
|
-
sql-mcp = sql_mcp.prompts
|
|
9
|
-
|
|
10
|
-
[agent_connector_sdk.skill_providers]
|
|
11
|
-
sql-mcp = sql_mcp.skills
|
|
12
|
-
|
|
13
|
-
[console_scripts]
|
|
14
|
-
sql-mcp = sql_mcp.mcp_server:mcp_server
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"""CONN-SQL-MCP-CONNECTOR-CONTENT-R001: the server lists its packaged skills, ontology and prompts by default."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import asyncio
|
|
6
|
-
import importlib
|
|
7
|
-
from pathlib import Path
|
|
8
|
-
|
|
9
|
-
import pytest
|
|
10
|
-
from fastmcp import Client
|
|
11
|
-
|
|
12
|
-
PACKAGE = "sql_mcp"
|
|
13
|
-
ROOT = Path(list(importlib.import_module(PACKAGE).__path__)[0])
|
|
14
|
-
|
|
15
|
-
pytestmark = pytest.mark.spec("CONN-SQL-MCP-CONNECTOR-CONTENT-R001")
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def _server():
|
|
19
|
-
namespace = {"__name__": PACKAGE + ".mcp_server"}
|
|
20
|
-
exec(
|
|
21
|
-
"from agent_connector_sdk.mcp.server import create_mcp_server\n"
|
|
22
|
-
"result = create_mcp_server('sql-mcp', version='0', command_args=[])",
|
|
23
|
-
namespace,
|
|
24
|
-
)
|
|
25
|
-
return namespace["result"][1]
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
async def _listings():
|
|
29
|
-
async with Client(_server()) as client:
|
|
30
|
-
resources = {str(r.uri) for r in await client.list_resources()}
|
|
31
|
-
prompts = {p.name for p in await client.list_prompts()}
|
|
32
|
-
return resources, prompts
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def test_default_content_surfaces() -> None:
|
|
36
|
-
resources, prompts = asyncio.run(_listings())
|
|
37
|
-
if list(ROOT.glob("skills/*/SKILL.md")):
|
|
38
|
-
assert any(u.startswith("skill://") for u in resources)
|
|
39
|
-
if list(ROOT.glob("ontology/*.ttl")):
|
|
40
|
-
assert any(u.startswith("ontology://sql-mcp/") for u in resources)
|
|
41
|
-
for path in ROOT.glob("prompts/*.json"):
|
|
42
|
-
if not path.name.startswith("_"):
|
|
43
|
-
assert path.stem in prompts
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
"""Characterization tests for scripts/verify_api_integration.py.
|
|
2
|
-
|
|
3
|
-
Loaded by file path (the script is not part of the installed package) and
|
|
4
|
-
exercised through its public functions: parse_api_client, parse_mcp_server,
|
|
5
|
-
verify_agent, and main's --local mode.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
from __future__ import annotations
|
|
9
|
-
|
|
10
|
-
import importlib.util
|
|
11
|
-
import sys
|
|
12
|
-
from pathlib import Path
|
|
13
|
-
|
|
14
|
-
import pytest
|
|
15
|
-
|
|
16
|
-
_SCRIPT_PATH = (
|
|
17
|
-
Path(__file__).resolve().parent.parent / "scripts" / "verify_api_integration.py"
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def _load_module():
|
|
22
|
-
spec = importlib.util.spec_from_file_location(
|
|
23
|
-
"verify_api_integration_under_test", _SCRIPT_PATH
|
|
24
|
-
)
|
|
25
|
-
assert spec is not None
|
|
26
|
-
module = importlib.util.module_from_spec(spec)
|
|
27
|
-
assert spec.loader is not None
|
|
28
|
-
spec.loader.exec_module(module)
|
|
29
|
-
return module
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@pytest.fixture()
|
|
33
|
-
def vai():
|
|
34
|
-
return _load_module()
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
API_CLIENT_SOURCE = '''
|
|
38
|
-
class SomeApiClient:
|
|
39
|
-
def __init__(self):
|
|
40
|
-
pass
|
|
41
|
-
|
|
42
|
-
def authenticate(self):
|
|
43
|
-
pass
|
|
44
|
-
|
|
45
|
-
def _private_helper(self):
|
|
46
|
-
pass
|
|
47
|
-
|
|
48
|
-
def get_repositories(self):
|
|
49
|
-
pass
|
|
50
|
-
|
|
51
|
-
def list_issues(self):
|
|
52
|
-
pass
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
class Unrelated:
|
|
56
|
-
def public_thing(self):
|
|
57
|
-
pass
|
|
58
|
-
'''
|
|
59
|
-
|
|
60
|
-
MCP_SERVER_SOURCE = '''
|
|
61
|
-
class Registrar:
|
|
62
|
-
def register(self, mcp):
|
|
63
|
-
@mcp.tool()
|
|
64
|
-
def github_list_repos(client):
|
|
65
|
-
return client.get_repositories()
|
|
66
|
-
|
|
67
|
-
@mcp.tool()
|
|
68
|
-
def github_list_issues(client):
|
|
69
|
-
return getattr(client, "list_issues")()
|
|
70
|
-
|
|
71
|
-
def not_a_tool(client):
|
|
72
|
-
return client.get_repositories()
|
|
73
|
-
'''
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def test_parse_api_client_finds_public_non_authenticate_methods(vai, tmp_path):
|
|
77
|
-
api_client = tmp_path / "api_client.py"
|
|
78
|
-
api_client.write_text(API_CLIENT_SOURCE)
|
|
79
|
-
|
|
80
|
-
methods = vai.parse_api_client(str(api_client))
|
|
81
|
-
|
|
82
|
-
assert set(methods) == {"get_repositories", "list_issues"}
|
|
83
|
-
assert methods["get_repositories"]["class"] == "SomeApiClient"
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
def test_parse_api_client_ignores_non_api_client_classes(vai, tmp_path):
|
|
87
|
-
api_client = tmp_path / "api_client.py"
|
|
88
|
-
api_client.write_text(
|
|
89
|
-
"""
|
|
90
|
-
class Plain:
|
|
91
|
-
def public_thing(self):
|
|
92
|
-
pass
|
|
93
|
-
"""
|
|
94
|
-
)
|
|
95
|
-
|
|
96
|
-
methods = vai.parse_api_client(str(api_client))
|
|
97
|
-
|
|
98
|
-
assert methods == {}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
def test_parse_mcp_server_maps_decorated_tool_to_api_methods(vai, tmp_path):
|
|
102
|
-
api_client = tmp_path / "api_client.py"
|
|
103
|
-
api_client.write_text(API_CLIENT_SOURCE)
|
|
104
|
-
mcp_server = tmp_path / "mcp_server.py"
|
|
105
|
-
mcp_server.write_text(MCP_SERVER_SOURCE)
|
|
106
|
-
|
|
107
|
-
api_methods = vai.parse_api_client(str(api_client))
|
|
108
|
-
tool_mappings, mapped = vai.parse_mcp_server(str(mcp_server), api_methods)
|
|
109
|
-
|
|
110
|
-
assert "github_list_repos" in tool_mappings
|
|
111
|
-
assert "not_a_tool" not in tool_mappings
|
|
112
|
-
assert mapped == {"get_repositories", "list_issues"}
|
|
113
|
-
assert set(tool_mappings["github_list_repos"]["methods"]) == {"get_repositories"}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
def test_parse_mcp_server_matches_bare_prefixed_function_without_decorator(vai, tmp_path):
|
|
117
|
-
api_client = tmp_path / "api_client.py"
|
|
118
|
-
api_client.write_text(API_CLIENT_SOURCE)
|
|
119
|
-
mcp_server = tmp_path / "mcp_server.py"
|
|
120
|
-
mcp_server.write_text(
|
|
121
|
-
"""
|
|
122
|
-
def github_undecorated(client):
|
|
123
|
-
return client.get_repositories()
|
|
124
|
-
|
|
125
|
-
def plain_helper(client):
|
|
126
|
-
return client.get_repositories()
|
|
127
|
-
"""
|
|
128
|
-
)
|
|
129
|
-
|
|
130
|
-
api_methods = vai.parse_api_client(str(api_client))
|
|
131
|
-
tool_mappings, mapped = vai.parse_mcp_server(str(mcp_server), api_methods)
|
|
132
|
-
|
|
133
|
-
assert "github_undecorated" in tool_mappings
|
|
134
|
-
assert "plain_helper" not in tool_mappings
|
|
135
|
-
assert mapped == {"get_repositories"}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
def test_verify_agent_returns_none_when_files_missing(vai, tmp_path):
|
|
139
|
-
assert vai.verify_agent(str(tmp_path)) is None
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
def test_verify_agent_computes_full_coverage(vai, tmp_path):
|
|
143
|
-
(tmp_path / "api_client.py").write_text(API_CLIENT_SOURCE)
|
|
144
|
-
(tmp_path / "mcp_server.py").write_text(MCP_SERVER_SOURCE)
|
|
145
|
-
|
|
146
|
-
result = vai.verify_agent(str(tmp_path))
|
|
147
|
-
|
|
148
|
-
assert result["agent_name"] == tmp_path.name
|
|
149
|
-
assert result["total_methods"] == 2
|
|
150
|
-
assert result["covered_methods"] == 2
|
|
151
|
-
assert result["coverage"] == pytest.approx(100.0)
|
|
152
|
-
assert result["unmapped"] == []
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
def test_verify_agent_reports_unmapped_methods_for_partial_coverage(vai, tmp_path):
|
|
156
|
-
(tmp_path / "api_client.py").write_text(API_CLIENT_SOURCE)
|
|
157
|
-
(tmp_path / "mcp_server.py").write_text(
|
|
158
|
-
"""
|
|
159
|
-
class Registrar:
|
|
160
|
-
def register(self, mcp):
|
|
161
|
-
@mcp.tool()
|
|
162
|
-
def github_list_repos(client):
|
|
163
|
-
return client.get_repositories()
|
|
164
|
-
"""
|
|
165
|
-
)
|
|
166
|
-
|
|
167
|
-
result = vai.verify_agent(str(tmp_path))
|
|
168
|
-
|
|
169
|
-
assert result["covered_methods"] == 1
|
|
170
|
-
assert result["unmapped"] == ["list_issues"]
|
|
171
|
-
assert result["coverage"] == pytest.approx(50.0)
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
def test_main_local_mode_skips_silently_when_no_files_found(vai, tmp_path, monkeypatch, capsys):
|
|
175
|
-
monkeypatch.chdir(tmp_path)
|
|
176
|
-
monkeypatch.setattr(sys, "argv", ["verify_api_integration.py", "--local"])
|
|
177
|
-
|
|
178
|
-
with pytest.raises(SystemExit) as exc:
|
|
179
|
-
vai.main()
|
|
180
|
-
|
|
181
|
-
assert exc.value.code == 0
|
|
182
|
-
assert "Skipping integration parity verification" in capsys.readouterr().out
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
def test_main_local_mode_passes_when_coverage_meets_baseline(vai, tmp_path, monkeypatch, capsys):
|
|
186
|
-
(tmp_path / "api_client.py").write_text(API_CLIENT_SOURCE)
|
|
187
|
-
(tmp_path / "mcp_server.py").write_text(MCP_SERVER_SOURCE)
|
|
188
|
-
monkeypatch.chdir(tmp_path)
|
|
189
|
-
monkeypatch.setattr(sys, "argv", ["verify_api_integration.py", "--local"])
|
|
190
|
-
monkeypatch.setitem(vai.BASELINES, tmp_path.name, 100.0)
|
|
191
|
-
|
|
192
|
-
with pytest.raises(SystemExit) as exc:
|
|
193
|
-
vai.main()
|
|
194
|
-
|
|
195
|
-
assert exc.value.code == 0
|
|
196
|
-
assert "PASSED" in capsys.readouterr().out
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
def test_main_local_mode_fails_when_coverage_degrades_below_baseline(vai, tmp_path, monkeypatch, capsys):
|
|
200
|
-
(tmp_path / "api_client.py").write_text(API_CLIENT_SOURCE)
|
|
201
|
-
(tmp_path / "mcp_server.py").write_text(
|
|
202
|
-
"""
|
|
203
|
-
class Registrar:
|
|
204
|
-
def register(self, mcp):
|
|
205
|
-
@mcp.tool()
|
|
206
|
-
def github_list_repos(client):
|
|
207
|
-
return client.get_repositories()
|
|
208
|
-
"""
|
|
209
|
-
)
|
|
210
|
-
monkeypatch.chdir(tmp_path)
|
|
211
|
-
monkeypatch.setattr(sys, "argv", ["verify_api_integration.py", "--local"])
|
|
212
|
-
monkeypatch.setitem(vai.BASELINES, tmp_path.name, 100.0)
|
|
213
|
-
|
|
214
|
-
with pytest.raises(SystemExit) as exc:
|
|
215
|
-
vai.main()
|
|
216
|
-
|
|
217
|
-
out = capsys.readouterr().out
|
|
218
|
-
assert exc.value.code == 1
|
|
219
|
-
assert "FAILED" in out
|
|
220
|
-
assert "list_issues" in out
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
def test_main_workspace_scan_reports_all_discovered_agents(vai, tmp_path, monkeypatch, capsys):
|
|
224
|
-
agents_root = tmp_path / "agent-packages" / "agents"
|
|
225
|
-
agent_ok = agents_root / "agent-ok"
|
|
226
|
-
agent_gap = agents_root / "agent-gap"
|
|
227
|
-
agent_ok.mkdir(parents=True)
|
|
228
|
-
agent_gap.mkdir(parents=True)
|
|
229
|
-
(agent_ok / "api_client.py").write_text(API_CLIENT_SOURCE)
|
|
230
|
-
(agent_ok / "mcp_server.py").write_text(MCP_SERVER_SOURCE)
|
|
231
|
-
(agent_gap / "api_client.py").write_text(API_CLIENT_SOURCE)
|
|
232
|
-
(agent_gap / "mcp_server.py").write_text(
|
|
233
|
-
"""
|
|
234
|
-
class Registrar:
|
|
235
|
-
def register(self, mcp):
|
|
236
|
-
@mcp.tool()
|
|
237
|
-
def github_list_repos(client):
|
|
238
|
-
return client.get_repositories()
|
|
239
|
-
"""
|
|
240
|
-
)
|
|
241
|
-
# main() derives agents_dir from its own file location two levels up
|
|
242
|
-
# from scripts/; simulate that by pointing __file__ inside the temp tree
|
|
243
|
-
# at <agents_root>/some-agent/scripts/verify_api_integration.py so that
|
|
244
|
-
# dirname(__file__)/../.. resolves back to agents_root.
|
|
245
|
-
fake_script_dir = agents_root / "some-agent" / "scripts"
|
|
246
|
-
fake_script_dir.mkdir(parents=True)
|
|
247
|
-
fake_script = fake_script_dir / "verify_api_integration.py"
|
|
248
|
-
fake_script.write_text(_SCRIPT_PATH.read_text())
|
|
249
|
-
|
|
250
|
-
spec = importlib.util.spec_from_file_location(
|
|
251
|
-
"verify_api_integration_workspace_scan", fake_script
|
|
252
|
-
)
|
|
253
|
-
assert spec is not None
|
|
254
|
-
module = importlib.util.module_from_spec(spec)
|
|
255
|
-
assert spec.loader is not None
|
|
256
|
-
spec.loader.exec_module(module)
|
|
257
|
-
|
|
258
|
-
monkeypatch.setattr(sys, "argv", ["verify_api_integration.py"])
|
|
259
|
-
|
|
260
|
-
module.main()
|
|
261
|
-
|
|
262
|
-
out = capsys.readouterr().out
|
|
263
|
-
assert "API to MCP Integration Parity Report" in out
|
|
264
|
-
assert "agent-ok" in out
|
|
265
|
-
assert "agent-gap" in out
|
|
266
|
-
assert "list_issues" in out # unmapped method surfaced in the gap detail
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sql_mcp-2.3.4 → sql_mcp-2.3.5}/sql_mcp/skills/sql-mcp-knowledge-graph-ingestion/WORKFLOW.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|