A hands-on workshop for learning how to build MCP (Model Context Protocol) servers using FastMCP and Python. This workshop progressively builds a Docker Hub query tool that can be used by AI assistants like Claude.
An MCP server that allows AI assistants to:
- Search for Docker images on Docker Hub
- Get detailed information about images
- Compare image statistics (pulls, stars)
- Filter by official vs. community images
This workshop is organized into progressive stages, represented as tags/branches in this repo. It is recommended to work through the branches in order, ensuring that the MCP server compiles and can be successfully be used before moving to the next stage:
Concepts: MCP basics, tool definition, simple responses
- Set up Python project with uv
- Create basic MCP server with FastMCP
- Implement a simple
greettool - Connect to Claude Desktop
What you'll learn:
- MCP server structure
- Tool decorators
- Basic parameter handling
Concepts: HTTP requests, API integration, pagination
- Add
search_imagestool - Query Docker Hub API
- Handle pagination
- Distinguish official vs. community images
What you'll learn:
- Making HTTP GET requests
- Parsing JSON responses
- Query parameter handling
- Data transformation
Concepts: Detailed queries, nested data
- Add
get_image_detailstool - Fetch image tags and metadata
- Handle image namespaces
Concepts: Multi-source queries, data analysis
- Add
compare_imagestool - Aggregate statistics
- Provide recommendations
- Python 3.10+
- uv package manager - Install uv
- Claude Desktop (or another MCP-compatible client)
git clone <your-repo-url>
cd simple-mcp-workshop
uv syncStart from scratch:
git checkout stage-1Or jump to a specific stage:
git checkout stage-2 # Docker Hub searchAdd to your Claude Desktop config (claude_desktop_config.json):
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"simple-workshop": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/simple-mcp-workshop",
"run",
"simple-mcp"
]
}
}
}Replace /ABSOLUTE/PATH/TO/simple-mcp-workshop with your actual path.
Quit and reopen Claude Desktop to load the MCP server.
In Claude Desktop, try:
- Stage 1: "Can you greet me?"
- Stage 2: "Search Docker Hub for nginx images"
- Stage 3: "Get details about specific container images"
- Stage 4: "Compare image x with image y to recommend which one I should use in this context"
simple-mcp-workshop/
├── .gitignore
├── README.md # This file
├── pyproject.toml # Python project configuration
├── uv.lock # Dependency lock file
└── src/
└── simple_mcp/
├── __init__.py
└── server.py # MCP server implementation
- greet(name: str) - Simple greeting tool for testing
- search_images(query: str, page: int, page_size: int) - Search Docker Hub
- Returns image name, description, stars, pulls
- Handles pagination
- Marks official images
- get_image_details(image_name: str) - Get detailed image info
- list_image_tags(image_name: str) - List available tags
- compare_images(image_names: list[str]) - Compare multiple images
# See all stages
git tag
# Switch to a stage
git checkout stage-1
git checkout stage-2
# Create a new branch from a stage
git checkout stage-2
git checkout -b my-experiments- Start at Stage 1 - Understand MCP basics
- Progress through stages - Each adds new concepts
- Experiment - Create your own branch and try modifications
- Reference previous stages - Checkout tags if you get stuck
The easiest way - just ask Claude to use your tools!
uv run python -c "from simple_mcp.server import search_images; print(search_images('nginx', 1, 10))"Use the official MCP Inspector tool to debug your server.
Make sure you've run uv sync to install dependencies.
- Check the config path is absolute (not relative)
- Restart Claude Desktop completely
- Check Claude Desktop logs for errors
Make sure you're in the project root and have run uv sync.
By completing this workshop, you'll understand:
- ✅ How MCP servers work
- ✅ Tool definition and parameter handling
- ✅ Making HTTP requests from MCP tools
- ✅ Parsing and transforming API responses
- ✅ Handling pagination and filtering
- ✅ Connecting MCP servers to AI assistants
- Add authentication - Use Docker Hub personal access tokens
- Add more APIs - GitHub, npm, PyPI
- Add resources - Expose configuration or data
- Add prompts - Pre-built conversation starters
- Deploy - Package and share your server
Found an issue or want to improve the workshop?
- Open an issue
- Submit a pull request
- Suggest new stages or features
MIT License - Feel free to use for learning and teaching!
Happy Building! 🚀
Questions? Check the git tags, each stage is fully working and documented.