MCP ExplorerExplorer

Elicitation Blackjack Example Mcp

@angrypenguinpngon 10 months ago
2 MIT
FreeCommunity
AI Systems
A demo of MCP elicitations. For sharing purposes.

Overview

What is Elicitation Blackjack Example Mcp

elicitation-blackjack-example-mcp is a demonstration project showcasing MCP Elicitations through an interactive blackjack game. It allows users to experience structured input requests in a fun and engaging way.

Use cases

Use cases include teaching users about MCP Elicitations, creating engaging game interfaces, and testing structured input handling in real-time applications.

How to use

To use elicitation-blackjack-example-mcp, set up the project by installing dependencies, then run the blackjack server. Players can start a game, make moves, and check the game state using specific commands.

Key features

Key features include betting prompts for user input validation, action prompts during gameplay, structured responses validated against JSON schemas, and an interactive game flow based on user responses.

Where to use

This project can be used in educational settings to demonstrate the functionality of MCP servers, as well as in game development to create interactive user experiences.

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

mcp[cli]>=1.0.0

3. Install dependencies with UV

# From project root
uv add -r requirements.txt

Or alternatively:

uv add "mcp[cli]"

4. Test with MCP Inspector

uv run mcp dev src/blackjack_server.py

5. Install in Claude Desktop

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!

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers