~6 months back, we launched the AI Engineering Hub repo, and yesterday, it crossed 10k+ stars on GitHub. It is also trending on GitHub today:
A small ask: If you love what we do, can you star us on GitHub here: AI Engineering Hub?
Won’t take more than 2 seconds. Thank you so much for your support.
Introduction to Sampling for MCP Workflows
Part 5 of the MCP crash course is now available, where we explain the process to integrate Sampling into MCP workflows.
More specifically, it covers:
What is sampling, and why is it useful?
Sampling support in FastMCP
How does it work on the server side?
How to write a sampling handler on the client side?
Model preferences
Use cases for sampling
Error handling and some best practices
Just like our past series on RAG and AI Agents, this series is both foundational and implementation-heavy, walking you through everything step-by-step.
Here’s what we have done so far:
In Part 1, we introduced:
Why context management matters in LLMs.
The limitations of prompting, chaining, and function calling.
The M×N problem in tool integrations..
And how MCP solves it through a structured Host–Client–Server model.
In Part 2, we went hands-on and covered:
The core capabilities in MCP (Tools, Resources, Prompts).
How JSON-RPC powers communication.
Transport mechanisms (Stdio, HTTP + SSE).
A complete, working MCP server with Claude and Cursor.
Comparison between function calling and MCPs.
In Part 3, we built a fully custom MCP client from scratch:
How to build a custom MCP client and not rely on prebuilt solutions like Cursor or Claude.
What the full MCP lifecycle looks like in action.
The true nature of MCP as a client-server architecture, as revealed through practical integration.
How MCP differs from traditional API and function calling, illustrated through hands-on implementations.
In Part 4, we built a full-fledged MCP workflow using tools, resources, and prompts.
What exactly are resources and prompts in MCP?
Implementing resources and prompts server-side.
How tools, resources, and prompts differ from each other.
Using resources and prompts inside the Claude Desktop.
A full-fledged real-world use case powered by coordination across tools, prompts, and resources.
This protocol is already powering real-world agentic systems.
And in this crash course, you’ll learn exactly how to implement and extend it, from first principles to production use.
Read the first two parts here:
Thanks for reading!