10
10
SemanticLayerConfig ,
11
11
)
12
12
from dbt_mcp .dbt_admin .client import DbtAdminAPIClient
13
+ from dbt_mcp .semantic_layer .client import SemanticLayerClientProtocol
13
14
14
15
15
16
class DbtMcpContext (Context [ServerSession , object , Request ]):
16
17
"""Custom context for the MCP server"""
17
18
18
19
_semantic_layer_config : SemanticLayerConfig | None = None
20
+ _semantic_layer_client : SemanticLayerClientProtocol | None = None
19
21
_discovery_config : DiscoveryConfig | None = None
20
22
_dbt_cli_config : DbtCliConfig | None = None
21
23
_admin_api_config : AdminApiConfig | None = None
@@ -26,13 +28,15 @@ def __init__(
26
28
request_context : RequestContext [ServerSession , object , Request ] | None = None ,
27
29
fastmcp : FastMCP | None = None ,
28
30
semantic_layer_config : SemanticLayerConfig | None = None ,
31
+ semantic_layer_client : SemanticLayerClientProtocol | None = None ,
29
32
discovery_config : DiscoveryConfig | None = None ,
30
33
dbt_cli_config : DbtCliConfig | None = None ,
31
34
admin_api_config : AdminApiConfig | None = None ,
32
35
admin_api_client : DbtAdminAPIClient | None = None ,
33
36
):
34
37
super ().__init__ (request_context = request_context , fastmcp = fastmcp )
35
38
self ._semantic_layer_config = semantic_layer_config
39
+ self ._semantic_layer_client = semantic_layer_client
36
40
self ._discovery_config = discovery_config
37
41
self ._dbt_cli_config = dbt_cli_config
38
42
self ._admin_api_config = admin_api_config
@@ -43,6 +47,11 @@ def get_semantic_layer_config(self) -> SemanticLayerConfig:
43
47
raise ValueError ("Semantic layer config is not set" )
44
48
return self ._semantic_layer_config
45
49
50
+ def get_semantic_layer_client (self ) -> SemanticLayerClientProtocol :
51
+ if self ._semantic_layer_client is None :
52
+ raise ValueError ("Semantic layer client is not set" )
53
+ return self ._semantic_layer_client
54
+
46
55
def get_discovery_config (self ) -> DiscoveryConfig :
47
56
if self ._discovery_config is None :
48
57
raise ValueError ("Discovery config is not set" )
0 commit comments