Skip to content

Commit 8f204ec

Browse files
authored
Split Databricks provider into CLI and REST implementations (#575)
1 parent 7892227 commit 8f204ec

21 files changed

+692
-140
lines changed

edda/edda_mcp/examples/client.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
1010
use edda_mcp::config::Config;
1111
use edda_mcp::providers::{
12-
CombinedProvider, DatabricksProvider, DeploymentProvider, GoogleSheetsProvider, IOProvider,
12+
CombinedProvider, DatabricksRestProvider, DeploymentProvider, GoogleSheetsProvider, IOProvider,
1313
};
1414
use edda_mcp::session::SessionContext;
1515
use eyre::Result;
@@ -27,15 +27,15 @@ async fn main() -> Result<()> {
2727
println!("Starting edda-mcp server in-process...");
2828

2929
// initialize providers
30-
let databricks = DatabricksProvider::new().ok();
30+
let databricks = DatabricksRestProvider::new().ok();
3131
let deployment = DeploymentProvider::new().ok();
3232
let google_sheets = GoogleSheetsProvider::new().await.ok();
3333
let io = IOProvider::new(None).ok();
3434

3535
let session_ctx = SessionContext::new(None);
3636
let config = Config::default();
3737
let provider =
38-
CombinedProvider::new(session_ctx, databricks, deployment, google_sheets, io, None, &config).map_err(|_| {
38+
CombinedProvider::new(session_ctx, databricks, None, deployment, google_sheets, io, None, &config).map_err(|_| {
3939
eyre::eyre!(
4040
"No integrations available. Configure at least one:\n\
4141
- Databricks: Set DATABRICKS_HOST and DATABRICKS_TOKEN\n\

edda/edda_mcp/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl Default for Config {
103103
with_deployment: true,
104104
with_workspace_tools: false,
105105
required_providers: vec![
106-
ProviderType::Databricks,
106+
ProviderType::DatabricksRest,
107107
ProviderType::Deployment,
108108
ProviderType::Io,
109109
],

edda/edda_mcp/src/main.rs

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use clap::{Parser, Subcommand};
22
use edda_mcp::paths;
33
use edda_mcp::providers::{
4-
CombinedProvider, DatabricksProvider, DeploymentProvider, GoogleSheetsProvider, IOProvider,
5-
ProviderType, WorkspaceTools,
4+
CombinedProvider, DatabricksCliProvider, DatabricksRestProvider, DeploymentProvider,
5+
GoogleSheetsProvider, IOProvider, ProviderType, WorkspaceTools,
66
};
77
use edda_mcp::session::SessionContext;
88
use edda_mcp::trajectory::TrajectoryTrackingProvider;
@@ -225,6 +225,16 @@ fn should_enable_provider(config: &edda_mcp::config::Config, provider: ProviderT
225225
config.required_providers.contains(&provider)
226226
}
227227

228+
/// helper to check if DatabricksRest provider should be enabled (checks both DatabricksRest and legacy Databricks)
229+
fn should_enable_databricks_rest(config: &edda_mcp::config::Config) -> bool {
230+
config.required_providers.contains(&ProviderType::DatabricksRest)
231+
}
232+
233+
/// helper to check if DatabricksCli provider should be enabled
234+
fn should_enable_databricks_cli(config: &edda_mcp::config::Config) -> bool {
235+
config.required_providers.contains(&ProviderType::DatabricksCli)
236+
}
237+
228238
/// check environment configuration and prerequisites
229239
async fn check_environment(config: &edda_mcp::config::Config) -> Result<()> {
230240
use edda_mcp::providers::ProviderType;
@@ -247,10 +257,10 @@ async fn check_environment(config: &edda_mcp::config::Config) -> Result<()> {
247257
}
248258
}
249259

250-
// check databricks environment variables only if databricks or deployment is required
260+
// check databricks environment variables only if databricks rest or deployment is required
251261
let databricks_required = config
252262
.required_providers
253-
.contains(&ProviderType::Databricks)
263+
.contains(&ProviderType::DatabricksRest)
254264
|| config
255265
.required_providers
256266
.contains(&ProviderType::Deployment);
@@ -402,10 +412,17 @@ async fn run_server(config: edda_mcp::config::Config) -> Result<()> {
402412
});
403413

404414
// initialize all available providers
405-
let databricks = match should_enable_provider(&config, ProviderType::Databricks) {
406-
true => DatabricksProvider::new().ok(),
415+
let databricks = match should_enable_databricks_rest(&config) {
416+
true => DatabricksRestProvider::new().ok(),
407417
false => None,
408418
};
419+
420+
// enable DatabricksCli provider if explicitly requested in config
421+
let databricks_cli = match should_enable_databricks_cli(&config) {
422+
true => DatabricksCliProvider::new().ok(),
423+
false => None,
424+
};
425+
409426
let deployment = match config.with_deployment {
410427
true => DeploymentProvider::new().ok(),
411428
false => None,
@@ -429,6 +446,9 @@ async fn run_server(config: edda_mcp::config::Config) -> Result<()> {
429446
if databricks.is_some() {
430447
providers_list.push("Databricks");
431448
}
449+
if databricks_cli.is_some() {
450+
providers_list.push("Databricks CLI");
451+
}
432452
if deployment.is_some() {
433453
providers_list.push("Deployment");
434454
}
@@ -461,6 +481,7 @@ async fn run_server(config: edda_mcp::config::Config) -> Result<()> {
461481
let provider = CombinedProvider::new(
462482
session_ctx,
463483
databricks,
484+
databricks_cli,
464485
deployment,
465486
google_sheets,
466487
io,

0 commit comments

Comments
 (0)