nickperkins/ice-cream-mcp
If you are the rightful owner of ice-cream-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This repository demonstrates how to build an MCP server with elicitation capabilities, focusing on interactive input, validation, and modular architecture.
ice_cream_topping_recommender
Recommends toppings based on ice cream flavors (vanilla, strawberry, or chocolate).
Ice Cream Topping Recommender MCP Server
š¦ A Demonstration Repository for MCP Elicitation
This is a minimal Model Context Protocol (MCP) server that showcases how to build MCP tools with elicitation capabilities. It serves as a practical learning resource for developers interested in creating interactive MCP servers that can prompt users for input when needed.
What This Demo Shows
This repository demonstrates several key MCP development patterns:
- š Elicitation (Interactive Input): The tool prompts users for missing parameters using schema-driven UI
- ā Input Validation: Type-safe validation using Zod schemas with helpful error messages
- šļø Modular Architecture: Clean separation between server setup, tool registration, and business logic
- š ļø Production Patterns: Proper error handling, logging, and TypeScript configuration
- š Client Integration: Ready-to-use configuration for VS Code and Claude Desktop
The Core Feature
The server exposes a single tool: ice_cream_topping_recommender
that recommends toppings based on ice cream flavours (vanilla, strawberry, or chocolate). When you invoke the tool without specifying a flavour, it demonstrates MCP's elicitation capability by prompting you to select one.
Example interaction:
š¤ Tool called without flavour parameter
š Prompts: "Which ice cream flavour do you want toppings for?"
š¤ User selects: "vanilla"
š¦ Response: "For vanilla ice cream, the best toppings are: caramel sauce, rainbow sprinkles, crushed cookies."
Quick Start
-
Install dependencies and build:
yarn install yarn build
-
Run the server:
yarn start
-
Integration with MCP clients:
- VS Code: The server auto-configures via
.vscode/mcp.json
- Claude Desktop: Add the server to your MCP configuration
- VS Code: The server auto-configures via
Project Structure
ice-cream-mcp/
āāā src/
ā āāā index.ts # Entry point & server bootstrap
ā āāā server/
ā āāā McpServer.ts # Complete MCP server implementation
āāā .vscode/
ā āāā mcp.json # VS Code MCP integration
āāā package.json # Dependencies & scripts
āāā tsconfig.json # TypeScript configuration
Key Learning Points
1. Elicitation Pattern
See how the tool handles missing input by prompting users with a schema-driven interface:
if (!flavour && elicitInput) {
const result = await elicitInput({
message: "Which ice cream flavour do you want toppings for?",
requestedSchema: {
type: "object",
properties: {
flavour: {
type: "string",
enum: ["vanilla", "strawberry", "chocolate"]
}
}
}
});
}
2. Modular Tool Architecture
Tools follow a consistent interface pattern:
getName()
: Unique identifiergetDescription()
: Human-readable descriptiongetInputSchema()
: Zod validation schemaexecute(args, elicitInput?)
: Main logic with elicitation support
3. Type Safety
All input is validated using Zod schemas before processing, ensuring robust error handling and clear user feedback.
Technical Details
- Language: TypeScript with ESM modules
- MCP SDK:
@modelcontextprotocol/sdk
v1.15.1 - Validation: Zod schemas for input validation
- Transport: stdio (standard input/output)
- Integration: VS Code MCP extension, Claude Desktop
Blog Post
š Read the detailed blog post about this implementation ā
Next Steps
- Clone this repository to explore the code
- Modify the tool to add new flavours or different recommendation logic
- Use this as a template for building your own MCP servers with elicitation
- Check out the detailed blog post (link above) for implementation insights
Perfect for: Developers learning MCP, building interactive tools, or wanting to understand elicitation patterns.
License
This project is licensed under the MIT License - see the file for details.