Content
# Blackjack MCP - Exploring Elicitations
## Goal
This project demonstrates **MCP Elicitations** through an interactive blackjack game! Elicitations allow MCP servers to request structured input from users during interactions. By playing blackjack, you'll experience how elicitations work in a fun, easy-to-understand way:
- **Betting prompts** - Server asks for your bet amount with validation
- **Action prompts** - Server asks "hit or stand?" during gameplay
- **Structured responses** - Your inputs are validated against JSON schemas
- **Interactive flow** - Game progresses based on your elicited responses
Perfect for learning how MCP servers can create dynamic, user-driven experiences!
## Setup with UV
## 1. Project Structure
```
blackjack_mcp/
├── src/
│ └── blackjack_server.py
├── requirements.txt
└── README.md
```
## 2. Create requirements.txt
```txt
mcp[cli]>=1.0.0
```
## 3. Install dependencies with UV
```bash
# From project root
uv add -r requirements.txt
```
Or alternatively:
```bash
uv add "mcp[cli]"
```
## 4. Test with MCP Inspector
```bash
uv run mcp dev src/blackjack_server.py
```
## 5. Install in Claude Desktop
```bash
uv run mcp install src/blackjack_server.py --name "Blackjack Casino"
```
## How to Play
1. **Start a new hand**: Use `start_game()` tool - it will ask for your bet amount
2. **Make your moves**: Use `player_action()` tool - hit or stand
3. **Check game state**: Use `show_game_state()` tool anytime
4. **Reset chips**: Use `reset_chips()` if you go broke
## Game Flow
1. `start_game()` - Prompts for bet, deals 2 cards each
2. `player_action()` - You choose hit or stand via elicitation
3. Dealer plays automatically (hits on 16, stands on 17)
4. Winner determined, chips updated
## Example Session
```
You: start_game()
MCP: [Prompts for bet amount]
You: [Enter "50"]
MCP: 🎲 NEW BLACKJACK HAND! Your cards: A♠ 7♥ (Value: 18)...
You: player_action()
MCP: [Prompts hit or stand]
You: [Choose "stand"]
MCP: Dealer reveals 10♦ 6♣, hits 9♠, busts! You win $100!
```
## Features
- **Real blackjack rules** with proper ace handling
- **Betting system** with chip management
- **Elicitation prompts** for bets and actions
- **Dealer AI** follows house rules
- **Blackjack payouts** (3:2 for natural 21)
- **Visual card display** with suits
Perfect for learning MCP elicitation while playing a fun game!
Connection Info
You Might Also Like
markitdown
Python tool for converting files and office documents to Markdown.
OpenAI Whisper
OpenAI Whisper MCP Server - 基于本地 Whisper CLI 的离线语音识别与翻译,无需 API Key,支持...
oh-my-opencode
Background agents · Curated agents like oracle, librarians, frontend...
claude-flow
Claude-Flow v2.7.0 is an enterprise AI orchestration platform.
ai-engineering-from-scratch
Learn it. Build it. Ship it for others. The most comprehensive open-source...
chatbox
User-friendly Desktop Client App for AI Models/LLMs (GPT, Claude, Gemini, Ollama...)