sql-mcp 2.3.3__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.
Files changed (69) hide show
  1. {sql_mcp-2.3.3/sql_mcp.egg-info → sql_mcp-2.3.5}/PKG-INFO +4 -6
  2. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/pyproject.toml +15 -17
  3. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/__init__.py +17 -1
  4. sql_mcp-2.3.5/sql_mcp/__main__.py +4 -0
  5. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/api_client.py +0 -2
  6. sql_mcp-2.3.5/sql_mcp/connector_sources.py +75 -0
  7. sql_mcp-2.3.5/sql_mcp/mcp_server.py +17 -0
  8. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/ontology/certification.json +4 -7
  9. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/ontology/database.ttl +2 -2
  10. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/prompts/database_specialist.json +0 -2
  11. {sql_mcp-2.3.3 → sql_mcp-2.3.5/sql_mcp.egg-info}/PKG-INFO +4 -6
  12. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp.egg-info/SOURCES.txt +2 -10
  13. sql_mcp-2.3.5/sql_mcp.egg-info/entry_points.txt +8 -0
  14. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp.egg-info/requires.txt +2 -5
  15. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/tests/test_api_wrapper.py +2 -2
  16. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/tests/test_auth.py +5 -5
  17. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/tests/test_dialect_paths.py +4 -4
  18. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/tests/test_kg_ingest.py +1 -1
  19. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/tests/test_startup.py +4 -22
  20. sql_mcp-2.3.3/MANIFEST.in +0 -4
  21. sql_mcp-2.3.3/requirements.txt +0 -3
  22. sql_mcp-2.3.3/sql_mcp/__main__.py +0 -4
  23. sql_mcp-2.3.3/sql_mcp/connectors/__init__.py +0 -0
  24. sql_mcp-2.3.3/sql_mcp/connectors/mcp_source_presets.json +0 -3
  25. sql_mcp-2.3.3/sql_mcp/connectors/tool_schema_fingerprints.json +0 -6
  26. sql_mcp-2.3.3/sql_mcp/mcp_server.py +0 -69
  27. sql_mcp-2.3.3/sql_mcp/prompts/__init__.py +0 -0
  28. sql_mcp-2.3.3/sql_mcp/skills/__init__.py +0 -0
  29. sql_mcp-2.3.3/sql_mcp.egg-info/entry_points.txt +0 -17
  30. sql_mcp-2.3.3/tests/test_default_content_surfaces.py +0 -43
  31. sql_mcp-2.3.3/tests/test_verify_api_integration.py +0 -266
  32. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/LICENSE +0 -0
  33. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/README.md +0 -0
  34. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/setup.cfg +0 -0
  35. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/api/__init__.py +0 -0
  36. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/api/api_client_sql.py +0 -0
  37. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/auth.py +0 -0
  38. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/dialects.py +0 -0
  39. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/kg_ingest.py +0 -0
  40. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/kg_pgwire.py +0 -0
  41. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/mcp/__init__.py +0 -0
  42. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/mcp/mcp_sql.py +0 -0
  43. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/mcp_config.json +0 -0
  44. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/ontology/__init__.py +0 -0
  45. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/ontology/fixtures/records.json +0 -0
  46. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/ontology/mappings/source.yaml +0 -0
  47. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/ontology/migrations/manifest.json +0 -0
  48. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/ontology/shapes/connector.shacl.ttl +0 -0
  49. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/safety.py +0 -0
  50. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/skills/sql-mcp-knowledge-graph-ingestion/SKILL.md +0 -0
  51. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/skills/sql-mcp-knowledge-graph-ingestion/WORKFLOW.md +0 -0
  52. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/skills/sql-mcp-operations/SKILL.md +0 -0
  53. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/skills/sql-mcp-operations/agents/openai.yaml +0 -0
  54. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/skills/sql-mcp-operations/references/catalog.md +0 -0
  55. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/skills/sql-mcp-query-execution/SKILL.md +0 -0
  56. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/skills/sql-mcp-query-execution/WORKFLOW.md +0 -0
  57. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/skills/sql-mcp-schema-inspection/SKILL.md +0 -0
  58. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/skills/sql-mcp-schema-inspection/WORKFLOW.md +0 -0
  59. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/sql_input_models.py +0 -0
  60. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp/sql_response_models.py +0 -0
  61. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp.egg-info/dependency_links.txt +0 -0
  62. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/sql_mcp.egg-info/top_level.txt +0 -0
  63. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/tests/test_dialects.py +0 -0
  64. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/tests/test_identity_context_scoping.py +0 -0
  65. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/tests/test_init_dynamics.py +0 -0
  66. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/tests/test_kg_pgwire.py +0 -0
  67. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/tests/test_package_getattr.py +0 -0
  68. {sql_mcp-2.3.3 → sql_mcp-2.3.5}/tests/test_safety.py +0 -0
  69. {sql_mcp-2.3.3 → 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
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: Project Maintainers <maintainers@users.noreply.github.com>
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]<1.0.0,>=0.3.18
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.3.18; 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[mcp,mssql,mysql,oracle,postgres]>=1.0.0; extra == "all"
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,46 +4,36 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "sql-mcp"
7
- version = "2.3.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.3.18,<1.0.0", "python-dotenv>=1.2.4", "sqlalchemy>=2.1.5",]
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 = "Project Maintainers"
15
- email = "maintainers@users.noreply.github.com"
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.3.18,<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[mcp,postgres,mysql,mssql,oracle]>=1.0.0",]
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 = "sql_mcp.mcp_server:mcp_server"
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
- [project.entry-points."agent_connector_sdk.source_connector_providers"]
42
- sql-mcp = "sql_mcp.connectors"
43
-
44
34
  # The one declared connector identity: the fleet name (SDK-CONNECTOR-CONTROL-R071).
45
35
  [project.entry-points."agent_connector_sdk.connector"]
46
- sql-mcp = "sql_mcp"
36
+ sql-mcp = "sql_mcp:connector"
47
37
 
48
38
  [tool.uv.workspace]
49
39
  members = ["."]
@@ -58,6 +48,7 @@ override-dependencies = [
58
48
 
59
49
 
60
50
  [tool.ruff]
51
+ extend-exclude = ["tests", "scripts"]
61
52
  line-length = 88
62
53
  target-version = "py312"
63
54
 
@@ -85,3 +76,10 @@ include = [ "sql_mcp*",]
85
76
 
86
77
  [tool.pipelines_hooks.ste]
87
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,4 @@
1
+ from agent_connector_sdk import run
2
+
3
+ if __name__ == "__main__":
4
+ run()
@@ -2,8 +2,6 @@
2
2
 
3
3
  from sql_mcp.api.api_client_sql import SqlApi
4
4
 
5
- __version__ = "0.1.0"
6
-
7
5
 
8
6
  class Api(SqlApi):
9
7
  """Multi-connection SQL client (SQLAlchemy 2.x Core) for the fleet."""
@@ -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,10 +1,7 @@
1
1
  {
2
- "api_version": "arbora.io/v1",
2
+ "api_version": "graphos.io/v1",
3
3
  "artifacts": {
4
- "connector_manifest.yml": "3f57351af0d7b55b2eb2e0cefdff0235b928cd8f9efe81f130c688424280a587",
5
- "sql_mcp/connectors/mcp_source_presets.json": "ed6bbb14d4a0e706bbe2caa1a714f06093273cc288d49aa43ff887dd5e129c46",
6
- "sql_mcp/connectors/tool_schema_fingerprints.json": "349901c65b6f1fd273ebdca0df935fab3308c612e7e7d334e836b5eded7fa3e5",
7
- "sql_mcp/ontology/database.ttl": "1486055962ef7a286c349f6d3974bbe5d8176e88b627fb59c201b79a78153c64",
4
+ "sql_mcp/ontology/database.ttl": "9bedb25413dbd4aa83ae76ec84b025e01f5e1affd1afc01e899e543e5ba2dbd2",
8
5
  "sql_mcp/ontology/fixtures/records.json": "2a06e3f58c45c99a612d756419b9029fc7d14f5acaa1db77f964e32cc58c28d1",
9
6
  "sql_mcp/ontology/mappings/source.yaml": "15faf4992ea561ea2ffa48bdd39ccb78823b11b31f32aeda2030479e700a521e",
10
7
  "sql_mcp/ontology/migrations/manifest.json": "18189bd6a40c3683809ed9d80a2179361bbc8ea79d11ed1c3bed6152f64c3396",
@@ -18,7 +15,7 @@
18
15
  "synthetic_fixture_contract": "passed"
19
16
  },
20
17
  "compatibility": {
21
- "agent_connector_sdk": ">=2.5.0,<3",
18
+ "agent_utilities": ">=2.5.0,<3",
22
19
  "bundle_schema": "2",
23
20
  "epistemic_graph": ">=2.27.0,<3"
24
21
  },
@@ -32,5 +29,5 @@
32
29
  "signer": "UNSIGNED-PREVIEW",
33
30
  "signing_public_key": "",
34
31
  "status": "source-validated",
35
- "validated_at": "2026-09-21T17:23:56Z"
32
+ "validated_at": "2026-10-24T12:18:45Z"
36
33
  }
@@ -69,8 +69,8 @@
69
69
  rdfs:comment """Ontology for modeling relational database schemas, tables, columns,
70
70
  and keys. This maps database artifacts to logical Data Objects at the
71
71
  ArchiMate Application/Technology layer, allowing code generators and
72
- planners to dynamically reason about data layouts.""" ;
73
- owl:imports <http://knuckles.team/kg/enterprise> .
72
+ planners to dynamically reason about data layouts.""" .
73
+
74
74
 
75
75
  :DatabaseSchema a owl:Class ;
76
76
  rdfs:label "Database Schema" ;
@@ -4,8 +4,6 @@
4
4
  "schema_version": "1.0",
5
5
  "prompt_version": "0.1.0",
6
6
  "source": "sql-mcp",
7
- "extends": "agent-connector-sdk:base",
8
- "compose": "append",
9
7
  "description": "Relational database specialist: safe parameterized querying, schema reflection, and knowledge-graph ingestion over the sql-mcp MCP server.",
10
8
  "metadata": {
11
9
  "topic": "Relational Databases",
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sql-mcp
3
- Version: 2.3.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: Project Maintainers <maintainers@users.noreply.github.com>
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]<1.0.0,>=0.3.18
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.3.18; 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[mcp,mssql,mysql,oracle,postgres]>=1.0.0; extra == "all"
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,12 +1,11 @@
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
9
7
  sql_mcp/auth.py
8
+ sql_mcp/connector_sources.py
10
9
  sql_mcp/dialects.py
11
10
  sql_mcp/kg_ingest.py
12
11
  sql_mcp/kg_pgwire.py
@@ -23,9 +22,6 @@ sql_mcp.egg-info/requires.txt
23
22
  sql_mcp.egg-info/top_level.txt
24
23
  sql_mcp/api/__init__.py
25
24
  sql_mcp/api/api_client_sql.py
26
- sql_mcp/connectors/__init__.py
27
- sql_mcp/connectors/mcp_source_presets.json
28
- sql_mcp/connectors/tool_schema_fingerprints.json
29
25
  sql_mcp/mcp/__init__.py
30
26
  sql_mcp/mcp/mcp_sql.py
31
27
  sql_mcp/ontology/__init__.py
@@ -35,9 +31,7 @@ sql_mcp/ontology/fixtures/records.json
35
31
  sql_mcp/ontology/mappings/source.yaml
36
32
  sql_mcp/ontology/migrations/manifest.json
37
33
  sql_mcp/ontology/shapes/connector.shacl.ttl
38
- sql_mcp/prompts/__init__.py
39
34
  sql_mcp/prompts/database_specialist.json
40
- sql_mcp/skills/__init__.py
41
35
  sql_mcp/skills/sql-mcp-knowledge-graph-ingestion/SKILL.md
42
36
  sql_mcp/skills/sql-mcp-knowledge-graph-ingestion/WORKFLOW.md
43
37
  sql_mcp/skills/sql-mcp-operations/SKILL.md
@@ -49,7 +43,6 @@ sql_mcp/skills/sql-mcp-schema-inspection/SKILL.md
49
43
  sql_mcp/skills/sql-mcp-schema-inspection/WORKFLOW.md
50
44
  tests/test_api_wrapper.py
51
45
  tests/test_auth.py
52
- tests/test_default_content_surfaces.py
53
46
  tests/test_dialect_paths.py
54
47
  tests/test_dialects.py
55
48
  tests/test_identity_context_scoping.py
@@ -59,5 +52,4 @@ tests/test_kg_pgwire.py
59
52
  tests/test_package_getattr.py
60
53
  tests/test_safety.py
61
54
  tests/test_sql_mcp_validation.py
62
- tests/test_startup.py
63
- tests/test_verify_api_integration.py
55
+ tests/test_startup.py
@@ -0,0 +1,8 @@
1
+ [agent_connector_sdk.connector]
2
+ sql-mcp = sql_mcp:connector
3
+
4
+ [agent_connector_sdk.prompt_providers]
5
+ sql-mcp = sql_mcp.prompts
6
+
7
+ [console_scripts]
8
+ sql-mcp = agent_connector_sdk.cli:serve
@@ -1,12 +1,9 @@
1
- agent-connector-sdk[mcp]<1.0.0,>=0.3.18
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[mcp,mssql,mysql,oracle,postgres]>=1.0.0
7
-
8
- [mcp]
9
- agent-connector-sdk[mcp]<1.0.0,>=0.3.18
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:pw@db/app",
329
- "oracle+oracledb://svc:pw@db/app",
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:supersecretpw@db:5432/dw"}),
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 "supersecretpw" not in json.dumps(described)
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:pw@db:5432/dw?"
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:supersecretpw@db:5432/dw"}),
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 "supersecretpw" not in caplog.text
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:pw@db:5432/app"},
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:pw@db:1433/mart"},
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:pw@db:1521/app"},
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:pw@db/x"},
161
+ connections={"fb": "firebird://svc:password@db/x"},
162
162
  allow_writes=False,
163
163
  max_rows=50,
164
164
  timeout=5.0,
@@ -100,7 +100,7 @@ async def test_ingest_entities_writes_nodes_and_edges(ingest):
100
100
  a_record = next(r for r in request.records if r.record_id == "a")
101
101
  assert a_record.payload["name"] == "t"
102
102
  assert request.relationships[0].relation_reference.endswith(
103
- "resources/DatabaseTable/relations/hasColumn"
103
+ "relations/DatabaseTable/hasColumn"
104
104
  )
105
105
 
106
106
 
@@ -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 sql_mcp.mcp_server import get_mcp_instance # noqa: E402
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
- mcp, args, middlewares = get_mcp_instance()
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
- mcp, args, middlewares = get_mcp_instance()
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
- mcp, _, _ = get_mcp_instance()
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.3/MANIFEST.in DELETED
@@ -1,4 +0,0 @@
1
- include LICENSE
2
- include README.md
3
- include requirements.txt
4
- recursive-include sql_mcp *.py *.json *.md *.yaml *.yml
@@ -1,3 +0,0 @@
1
- agent-connector-sdk[mcp]>=0.3.0,<1.0.0
2
- python-dotenv>=1.0.0
3
- sqlalchemy>=2.0.0
@@ -1,4 +0,0 @@
1
- from sql_mcp.mcp_server import mcp_server
2
-
3
- if __name__ == "__main__":
4
- mcp_server()
File without changes
@@ -1,3 +0,0 @@
1
- {
2
- "_comment": "Tier-1 mcp_tool source presets for sql-mcp (AU-KG.ingest.mcp-tool-connector). Declarative doc-sync leg that syncs a connection's tables into the KG as lightweight 'database_table' documents via the sql-mcp MCP server. The primary, richer path is the native typed-node tool 'sql_ingest_schema' (see sql_mcp.kg_ingest), which emits :DatabaseTable/:DatabaseColumn/:DatabaseView/:DatabaseIndex nodes with structural links; this preset is the zero-code declarative complement. Contributed presets win over the central MCP_TOOL_PRESETS. The declarative sql-tables sweep is retired: a table sweep has no record identity and belongs to a data-platform source adapter; sql_ingest_schema is the supported path."
3
- }
@@ -1,6 +0,0 @@
1
- {
2
- "algorithm": "agent-connector-sdk:mcp-tool-contract-compat:v2",
3
- "connector": "sql-mcp",
4
- "schema_version": "1",
5
- "tools": {}
6
- }
@@ -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.3"
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,17 +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
- [agent_connector_sdk.source_connector_providers]
14
- sql-mcp = sql_mcp.connectors
15
-
16
- [console_scripts]
17
- 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