Skip to content

Commit 35e4ce0

Browse files
aitools: Add non-interactive installation (#4248)
## Changes Makes it possible for AIs to install AI Tools for themselves without needing to use an interactive terminal session. ## Why I want to see if we can create a prompt for having AIs install the tools themselves. ## Tests * Existing tests * Manual validation --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 0ba343a commit 35e4ce0

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

experimental/aitools/cmd/install.go

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,29 @@ func newInstallCmd() *cobra.Command {
2626
}
2727

2828
func runInstall(ctx context.Context) error {
29+
// Check for non-interactive mode with agent detection
30+
// If running in an AI agent, install automatically without prompts
31+
if !cmdio.IsTTY(os.Stdin) {
32+
if os.Getenv("CLAUDECODE") != "" {
33+
if err := agents.InstallClaude(); err != nil {
34+
return err
35+
}
36+
cmdio.LogString(ctx, color.GreenString("✓ Installed Databricks MCP server for Claude Code"))
37+
cmdio.LogString(ctx, color.YellowString("⚠️ Please restart Claude Code for changes to take effect"))
38+
return nil
39+
}
40+
if os.Getenv("CURSOR_AGENT") != "" {
41+
if err := agents.InstallCursor(); err != nil {
42+
return err
43+
}
44+
cmdio.LogString(ctx, color.GreenString("✓ Installed Databricks MCP server for Cursor"))
45+
cmdio.LogString(ctx, color.YellowString("⚠️ Please restart Cursor for changes to take effect"))
46+
return nil
47+
}
48+
// Unknown agent in non-interactive mode - show manual instructions
49+
return agents.ShowCustomInstructions(ctx)
50+
}
51+
2952
cmdio.LogString(ctx, "")
3053
green := color.New(color.FgGreen).SprintFunc()
3154
cmdio.LogString(ctx, " "+green("[")+"████████"+green("]")+" Experimental Databricks AI Tools MCP server")
@@ -34,9 +57,9 @@ func runInstall(ctx context.Context) error {
3457
cmdio.LogString(ctx, "")
3558

3659
yellow := color.New(color.FgYellow).SprintFunc()
37-
cmdio.LogString(ctx, yellow("════════════════════════════════════════════════════════════════"))
38-
cmdio.LogString(ctx, yellow(" ⚠️ EXPERIMENTAL: This command may change in future versions "))
39-
cmdio.LogString(ctx, yellow("════════════════════════════════════════════════════════════════"))
60+
cmdio.LogString(ctx, yellow("════════════════════════════════════════════════════════════════"))
61+
cmdio.LogString(ctx, yellow(" ⚠️ EXPERIMENTAL: This command may change in future versions "))
62+
cmdio.LogString(ctx, yellow("════════════════════════════════════════════════════════════════"))
4063
cmdio.LogString(ctx, "")
4164

4265
cmdio.LogString(ctx, "Which coding agents would you like to install the MCP server for?")

0 commit comments

Comments
 (0)