Skip to content

Commit e437b3a

Browse files
committed
Fix apps-mcp agent behavior: localhost preference and deployment confirmation
Two key issues addressed: 1. Agent was opening deployed URLs instead of localhost when user asked to "open a dev copy" or see the app during development. 2. Agent was deploying too early without user confirmation. Changes: - apps.tmpl: Add localhost guidance and deployment confirmation requirement - CLAUDE.md: Add "Deployment Procedures" section with pre-deployment checklist - CLAUDE.md: Add "Local Development vs Deployed Apps" section with decision tree The agent will now: - Prefer localhost:8000 during active development - Ask "Ready to deploy to [environment]?" before deploying - Only use deployed URLs after deployment with user approval Addresses feedback from PR #4045 discussion.
1 parent 4d46dd1 commit e437b3a

File tree

2 files changed

+92
-2
lines changed
  • experimental/apps-mcp

2 files changed

+92
-2
lines changed

experimental/apps-mcp/lib/prompts/apps.tmpl

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,43 @@ DATABRICKS APPS DEVELOPMENT
1515

1616
invoke_databricks_cli 'experimental apps-mcp tools init-template --name my-app-name --description "My app description"'
1717

18+
# Local Development
19+
20+
⚠️ PRIMARY development workflow - run app locally:
21+
22+
1. Navigate to app directory: cd ./your-app
23+
2. Start dev server: npm run dev
24+
3. Open in browser: http://localhost:8000
25+
26+
⚠️ IMPORTANT: When user asks to "open the app", "see the app", or "open dev copy":
27+
- During development → ALWAYS use http://localhost:8000 (requires npm run dev to be running)
28+
- After deployment → Use deployed URL from bundle summary
29+
30+
DO NOT suggest deployed URLs (staging/production) when user wants to test during development!
31+
1832
# Validation
1933

2034
⚠️ Always validate your app before deploying to production:
2135

2236
invoke_databricks_cli 'experimental apps-mcp tools validate ./your-app-location'
2337

38+
This runs: npm install → build → typecheck → tests
39+
2440
# Deployment
2541

26-
⚠️ Use the deploy command which validates, deploys, and runs the app:
42+
⚠️ CRITICAL: NEVER deploy without explicit user confirmation!
43+
44+
Deployment checklist (confirm with user BEFORE deploying):
45+
1. App has been validated successfully
46+
2. Local testing completed (npm run dev)
47+
3. User explicitly approved deployment
48+
49+
⚠️ ALWAYS ask user: "Ready to deploy to [environment]?" before running deploy command.
50+
51+
Once confirmed, use the deploy command:
2752

2853
invoke_databricks_cli 'experimental apps-mcp tools deploy'
2954

30-
# View and manage your app:
55+
After deployment, get the app URL:
3156

3257
invoke_databricks_cli 'bundle summary'

experimental/apps-mcp/templates/appkit/template/{{.project_name}}/CLAUDE.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,71 @@ TypeScript full-stack template powered by **Databricks AppKit** with tRPC for ad
3737
- Pre-commit: `npm run typecheck && npm run lint:fix && npm run format:fix && npm test`
3838
- Pre-deploy: `npm run build && npm start` (test locally) → `npm test`
3939

40+
## Deployment Procedures
41+
42+
**CRITICAL**: Deployment is a significant action that affects live environments. NEVER deploy without explicit user confirmation.
43+
44+
### Before Deploying
45+
46+
**ALWAYS** confirm with the user first by asking: "Ready to deploy to [environment]?"
47+
48+
Pre-deployment checklist:
49+
1. ✅ App validated successfully (`databricks experimental apps-mcp tools validate .`)
50+
2. ✅ Local testing completed (`npm run dev` and manual verification)
51+
3. ✅ User explicitly approved deployment
52+
4. ✅ Code committed to git (recommended)
53+
54+
### Deployment Commands
55+
56+
```bash
57+
databricks bundle deploy # Deploy app infrastructure
58+
databricks bundle run app # Start the app
59+
databricks bundle summary # Get deployed app URL
60+
```
61+
62+
Or use the all-in-one command:
63+
```bash
64+
databricks experimental apps-mcp tools deploy # Validates, deploys, and runs
65+
```
66+
67+
**DO NOT** run deployment commands unless the user explicitly requests it or confirms when asked.
68+
69+
## Local Development vs Deployed Apps
70+
71+
**CRITICAL**: Understand the difference between local development and deployed environments.
72+
73+
### During Development (Before Deployment)
74+
75+
When the user asks to "open the app", "see the app", "view the app", or "open a dev copy":
76+
77+
-**Use localhost**: `http://localhost:8000`
78+
-**Requires**: `npm run dev` must be running
79+
-**Purpose**: Hot reload, fast iteration, debugging
80+
81+
**DO NOT** suggest deployed URLs (staging/production) during active development!
82+
83+
### After Deployment
84+
85+
Only after running `databricks bundle deploy && databricks bundle run app`:
86+
87+
-**Use deployed URL**: Get from `databricks bundle summary`
88+
-**Purpose**: Production/staging environment, sharing with others
89+
90+
### Decision Tree
91+
92+
```
93+
User asks to "open the app" or "see the app"
94+
95+
├─ Has the app been deployed in this session?
96+
│ ├─ No → Use http://localhost:8000 (start with `npm run dev` if needed)
97+
│ └─ Yes → Ask user which environment they want:
98+
│ • localhost (development)
99+
│ • deployed URL (production/staging)
100+
101+
└─ User explicitly says "localhost" or "local"
102+
→ Always use http://localhost:8000
103+
```
104+
40105
## App Naming Constraints
41106

42107
App names must not exceed 30 characters total (including target prefix).

0 commit comments

Comments
 (0)