An open API service indexing awesome lists of open source software.

https://github.com/databricks-solutions/mcp-workshop


https://github.com/databricks-solutions/mcp-workshop

Last synced: 5 months ago
JSON representation

Awesome Lists containing this project

README

          

# Databricks MCP Workshop

Interactive workshop for learning how to build agents on Databricks with hands-on examples covering managed servers, external integrations, custom server development and local IDE setup.

## ๐ŸŽ“ Workshop Participant Setup

**For workshop participants** - Get your own isolated environment with one command:

```bash
git clone https://github.com/databricks-solutions/mcp-workshop
cd mcp-workshop
./setup.sh
```

This interactive setup creates your personal workshop environment:
- ๐Ÿ—๏ธ **Your own Unity Catalog** with sample data
- ๐Ÿš€ **Custom MCP server** deployed as a Databricks App
- ๐Ÿ’ป **Local development** environment
- ๐Ÿ” **Secure authentication** setup

Each participant gets isolated resources (e.g., `mcp_workshop_john_doe`) - no conflicts, no shared data issues!

๐Ÿ‘‰ **[See detailed setup guide โ†’](./WORKSHOP_SETUP.md)**

### ๐Ÿข Enterprise/Admin-Managed Setup

For workshops where participants don't have catalog creation permissions:

1. **Admin:** Run `setup/admin_bulk_setup.py` notebook โ†’ [Admin Guide](./ADMIN_WORKSHOP_GUIDE.md)
2. **Participants:** Follow the quick start โ†’ [Participant Guide](./PARTICIPANT_QUICK_START.md)

Each participant gets their own isolated schema within a shared catalog - no jobs, no catalog creation needed!

---
### Access the Workshop

After deployment, access the workshop locally:

1. Navigate to the frontend: `cd frontend`
2. Start the dev server: `npm run dev`
3. Visit **http://localhost:3000** to start the workshop

Your MCP server will be deployed as a Databricks App (check the Apps page)

## ๐Ÿ“š Workshop Content

### Section 1: Managed MCP Servers (45 min)
Learn to use Databricks-managed MCP servers with:
- Unity Catalog functions and permissions
- Vector Search for RAG applications
- Genie Spaces for natural language SQL
- Automated vs Interactive modes

### Section 2: External MCP Servers (40 min)
Integrate third-party services:
- Unity Catalog connections
- GitHub, Atlassian, Slack integrations
- Custom API connections
- Proxy authentication and security

### Section 3: Custom MCP Servers (60 min)
Build and deploy your own:
- Simple `@mcp.tool()` decorator pattern (based on [databrickslabs/mcp](https://github.com/databrickslabs/mcp))
- Databricks SDK integration (clusters, warehouses, SQL)
- Markdown-based prompts for reusable commands
- **Databricks Apps deployment** with automated scripts
- End-to-end testing and debugging tools

### Section 4: Local IDE Integration (30 min)
Connect your development environment:
- Cursor IDE configuration
- Claude Desktop setup
- VS Code with MCP extensions
- OAuth and PAT authentication

## ๐Ÿ” Authentication Model

This workshop uses **Databricks Apps built-in authentication** exclusively:

- **User Authorization**: Your access token is automatically forwarded via `x-forwarded-access-token` header
- **App Authorization**: Service principal credentials via `DATABRICKS_CLIENT_ID` and `DATABRICKS_CLIENT_SECRET` environment variables
- **Unified Permissions**: All operations respect your existing Unity Catalog permissions
- **Zero Setup**: No manual token management or OAuth flows required

[Learn more about Databricks Apps authentication โ†’](https://docs.databricks.com/aws/en/dev-tools/databricks-apps/auth)

## ๐Ÿ› ๏ธ Architecture

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Databricks Workspace โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚ โ”‚ Local Dev โ”‚ โ”‚ Unity Catalog โ”‚ โ”‚
โ”‚ โ”‚ Frontend โ”‚โ—„โ”€โ”€โ–บโ”‚ - mcp_workshop catalog โ”‚ โ”‚
โ”‚ โ”‚ (Next.js) โ”‚ โ”‚ - Sample data & schemas โ”‚ โ”‚
โ”‚ โ”‚ โ”‚ โ”‚ - Vector Search indexes โ”‚ โ”‚
โ”‚ โ”‚ http:// โ”‚ โ”‚ - Genie Spaces โ”‚ โ”‚
โ”‚ โ”‚ localhost:3000 โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ MCP Integrations โ”‚ โ”‚
โ”‚ โ”‚ Setup Jobs โ”‚ โ”‚ - Managed MCP servers โ”‚ โ”‚
โ”‚ โ”‚ - Catalog โ”‚ โ”‚ - External connections โ”‚ โ”‚
โ”‚ โ”‚ - Sample data โ”‚ โ”‚ - Custom MCP App (deployed) โ”‚ โ”‚
โ”‚ โ”‚ - Vector index โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

## ๐Ÿ“ Project Structure

```
mcp-workshop/
โ”œโ”€โ”€ databricks.yml # Bundle configuration
โ”œโ”€โ”€ frontend/ # Next.js workshop application (local dev)
โ”‚ โ”œโ”€โ”€ src/
โ”‚ โ”‚ โ”œโ”€โ”€ app/ # App router pages
โ”‚ โ”‚ โ””โ”€โ”€ components/ # React components
โ”‚ โ””โ”€โ”€ package.json
โ”œโ”€โ”€ custom-mcp-template/ # Custom MCP server (deployed to Databricks Apps)
โ”‚ โ”œโ”€โ”€ server/ # FastAPI MCP server
โ”‚ โ”œโ”€โ”€ client/ # React client UI
โ”‚ โ””โ”€โ”€ deploy.sh # Deployment script
โ””โ”€โ”€ setup/ # Workshop setup jobs
โ”œโ”€โ”€ create_workshop_catalog.py
โ”œโ”€โ”€ setup_sample_data.py
โ””โ”€โ”€ deploy_mcp_template.py
```

## ๐ŸŽฏ Learning Objectives

By the end of this workshop, you'll be able to:

- โœ… Use Databricks managed MCP servers in your applications
- โœ… Integrate external MCP servers via Unity Catalog connections
- โœ… Build and deploy custom MCP servers as Databricks Apps
- โœ… Implement proper authentication and authorization patterns
- โœ… Apply MCP best practices for production deployments
- โœ… Connect local IDEs to Databricks MCP resources

## ๐Ÿ”ง Development

To run the workshop locally for development:

```bash
cd app
npm install
npm run dev
```

The app will run at `http://localhost:3000` with mock authentication for development.

## ๐Ÿ“ Customization

### Adding New Workshop Sections

1. Update `src/lib/workshop-config.ts` with new section definitions
2. Create component files in `src/components/workshop/sections/`
3. Add any required setup jobs to `databricks.yml`
4. Deploy with `databricks bundle deploy`

### Modifying Authentication Scopes

Update the `user_authorization.scopes` in `databricks.yml`:

```yaml
user_authorization:
enabled: true
scopes:
- "sql" # SQL warehouse access
- "files.files" # File operations
- "dashboards.genie" # Genie Spaces (add if needed)
- "your-custom-scope" # Additional scopes
```

## ๐Ÿงน Workshop Management

### Cleanup After Workshop (for workspace admins/instructors)

The workshop creates user-specific resources in the workspace that should be cleaned up afterwards:

```bash
# List all workshop participants
./cleanup_workshop.sh --list

# Clean up specific participant
./cleanup_workshop.sh --participant john_doe

# Clean up ALL workshop resources (โš ๏ธ DESTRUCTIVE)
./cleanup_workshop.sh --all
```

### Monitor Workshop Usage

```bash
# View participant resources
./cleanup_workshop.sh --list

# Check catalog sizes
databricks sql query "SELECT catalog_name, SIZE_GB FROM information_schema.catalog_storage WHERE catalog_name LIKE 'mcp_workshop_%'"

# List workshop apps
databricks apps list | grep "mcp-custom-server-"
```

## ๐Ÿ†˜ Troubleshooting

### Common Issues

**App won't start**: Check that all required environment variables are set in the bundle configuration.

**Authentication errors**: Ensure user authorization is enabled and required scopes are configured.

**Resource access denied**: Verify Unity Catalog permissions for the workshop catalog and resources.

**Health check failing**: Check that the app is listening on port 3000 and `/api/health` endpoint responds.

**Setup script fails**: Ensure Databricks CLI is configured and you have catalog creation permissions.

### Getting Help

- Check the app logs in Databricks workspace
- Verify bundle deployment with `databricks bundle validate`
- Review [Databricks Apps documentation](https://docs.databricks.com/aws/en/dev-tools/databricks-apps/)
- For participant setup issues, see [WORKSHOP_SETUP.md](./WORKSHOP_SETUP.md)
- Submit issues to the workshop repository

## ๐Ÿ”€ Choosing Your MCP Approach

This workshop uses a simplified approach based on **[databrickslabs/mcp](https://github.com/databrickslabs/mcp)** - perfect for learning MCP fundamentals.

### This Workshop: databrickslabs/mcp
โœ… **Simpler structure** - fewer files, easier to understand
โœ… **Focus on tool creation** - `@mcp.tool()` decorator pattern
โœ… **Officially supported** - maintained by Databricks Labs
โœ… **Quick deployment** - streamlined for Databricks Apps

### Alternative: databricks-solutions Repository

For **Claude Code/Cursor users** wanting enhanced IDE integration:

**[databricks-solutions/custom-mcp-databricks-app](https://github.com/databricks-solutions/custom-mcp-databricks-app)**

Features:
- Enhanced IDE integration (Claude Code, Cursor)
- `.claude/commands` directory support
- FastMCP framework with routers
- Built-in MCP inspector
- More production-ready patterns

**๐Ÿ’ก Recommendation:** Start with this workshop to learn the fundamentals. If you're a heavy Claude Code or Cursor user, explore the databricks-solutions repository as your next step!

## ๐Ÿ“– Additional Resources

- [databrickslabs/mcp Repository](https://github.com/databrickslabs/mcp) - Official examples
- [Databricks MCP Documentation](https://docs.databricks.com/mcp)
- [Model Context Protocol Specification](https://modelcontextprotocol.io)
- [Databricks Apps Guide](https://docs.databricks.com/dev-tools/databricks-apps)
- [FastMCP Documentation](https://fastmcp.org/)

## ๐Ÿ“„ License

ยฉ 2025 Databricks, Inc. All rights reserved. The source in this notebook is provided subject to the Databricks License [https://databricks.com/db-license-source]. All included or referenced third party libraries are subject to the licenses set forth below.

---

**Ready to learn?** Deploy the workshop and start exploring! ๐Ÿš€