Build an MCP Client with FastMCP and Python

A Model Context Protocol (MCP) server exposes tools, resources, and prompts; an MCP client is what connects to that server, discovers those capabilities, and calls them. Clients are usually embedded in an AI application (Claude Desktop, Claude Code, or your own agent), but writing a standalone client is the clearest way to understand the protocol and to script, test, or debug a server. In this tutorial you will build a command-line MCP client with FastMCP. It connects to any MCP server over stdio, prints the server’s advertised tools, resources, and prompts, and calls a tool with JSON arguments. You will run it against a small demo server, then cover it with pytest using FastMCP’s in-memory transport — no subprocess required. ...

13 min

Build an MCP Server with FastMCP and Python

The Model Context Protocol (MCP) is an open standard that lets AI clients (such as Claude Desktop, Claude Code, or your own agent) call tools, read resources, and load prompts from an external server over a well-defined wire protocol. FastMCP is a Python framework that hides the protocol plumbing behind plain decorators, so you write ordinary typed functions and FastMCP turns them into a compliant server. In this tutorial you will build a small but realistic “notes” MCP server: it exposes tools to create and search notes, a resource to read a single note by URI, and a prompt that asks the model to summarize a note. You will run it over stdio, inspect it interactively, and cover it with pytest using FastMCP’s in-memory client. ...

13 min

Build a Python Hello World Application

A minimal Python project that prints a greeting, accepts a name from the command line, includes a pytest test suite, and uses a Makefile to drive common tasks. This tutorial covers project setup with uv, argument parsing, testing with pytest, and automation for a simple but complete workflow. Prerequisites Python 3.10 or later uv 0.4 or later (curl -LsSf https://astral.sh/uv/install.sh | sh) A Unix-like terminal (macOS, Linux, or WSL on Windows) make installed (pre-installed on macOS and most Linux distributions) Step 1: Initialize the project with uv Create the file uv init hello-world cd hello-world Detailed breakdown uv init hello-world scaffolds a new Python project with a pyproject.toml, a main.py sample file, and a .python-version file. pyproject.toml serves as the project manifest, replacing the need for setup.py or requirements.txt. uv automatically creates a .venv virtual environment on first run. Step 2: Add pytest and set up the project Create the file Remove the generated sample file and add pytest as a dev dependency: ...

6 min

Build a CLI Task Manager in Python

A command-line task manager that stores tasks in a local JSON file, supports adding, listing, completing, and deleting tasks, and uses only the Python standard library. Prerequisites Python 3.10 or later uv 0.4 or later (curl -LsSf https://astral.sh/uv/install.sh | sh) A Unix-like terminal (macOS, Linux, or WSL on Windows) make installed (pre-installed on macOS and most Linux distributions) Step 1: Set up the project structure Create the file uv init cli-task-manager cd cli-task-manager rm main.py README.md uv add --dev pytest Add the code: .gitignore __pycache__/ *.pyc .venv/ .pytest_cache/ *.egg-info/ dist/ build/ .DS_Store *.log tmp/ tasks.json Detailed breakdown uv init cli-task-manager scaffolds a new Python project with a pyproject.toml, a main.py sample file, and a .python-version file. rm main.py README.md removes the placeholder files since the project will use its own package structure. uv add --dev pytest installs pytest and records it under [dependency-groups] in pyproject.toml. __pycache__/ and *.pyc exclude Python bytecode files generated at runtime. .venv/ excludes the virtual environment that uv manages locally. tasks.json is excluded because it is runtime data, not source code. Each user generates their own task file. .DS_Store and tmp/ cover common OS and temporary artifacts. Step 2: Create the task storage module This module handles all persistence — reading and writing tasks to a JSON file on disk. ...

10 min