PTENES
MODULE 2.1

🐍 Installing Python and uv

Set up Python 3.11+ and the uv package manager—the basic tools for creating MCP Servers in Python.

6
Topics
25
Minutes
Basic
Level
Practical
Type
1

🐍 What Is Python and Why Use It

Python is the world's most popular programming language for AI development, automation, and scripting. Its clear, readable syntax makes it ideal for both beginners and experienced professionals. In the context of MCP, Python is the number one choice thanks to the official SDK FastMCP, which greatly simplifies creating MCP servers.

💎 Core Concept

Python is a high-level, interpreted, dynamically typed programming language. In the MCP ecosystem, Python stands out for offering the SDK FastMCP — a library that lets you create complete MCP servers with just a few lines of code. The combination of Python's simplicity and FastMCP's convenience makes it possible to create a functional MCP Server in under 10 minutes, even if you've never programmed before.

📊 Data and Research

Python is used in 60%+ of MCP Servers published by the community. The language has led the TIOBE popularity index for consecutive years and has the world’s largest AI library ecosystem—including TensorFlow, PyTorch, LangChain, and, of course, FastMCP. The Python community contributes more than 500,000 packages to PyPI, so you'll always find a library for any integration need.

2

📦 Installing Python 3.11+

The first step to creating MCP Servers in Python is to install the correct version of the language. FastMCP requires Python 3.11 or higher, since it uses modern language features such as advanced typing and improved asyncio. The installation process varies by operating system, but it’s simple on all of them.

💎 Core Concept

O Python 3.11+ is required because FastMCP and the official MCP SDK use features introduced in this version, such as Exception Groups, significant performance improvements (up to 25% faster than 3.10) and advanced typing with native support for generic types. Installing an earlier version can cause import errors and incompatibilities that are difficult to diagnose.

📋 Installation by Operating System
Windows

Access python.org/downloads, download the installer, and run it. Required check the "Add Python to PATH" option before clicking Install. After installation, open PowerShell and test with python --version.

macOS

Install via Homebrew: brew install python. Homebrew already configures the PATH automatically. If you don't have Homebrew, install it first at brew.sh.

Linux

Ubuntu/Debian: sudo apt update && sudo apt install python3.11. Fedora/RHEL: sudo dnf install python3.11. Most distros already come with Python, but it may be an older version.

🚨 Alert

Check the minimum version! Execute python --version or python3 --version and confirm that it is 3.11 or higher. Versions such as 3.9 or 3.10 may seem to work initially, but will cause errors when you try to use FastMCP. On Linux, the command may be python3 instead of python.

3

⚡ What Is uv

O uv is a next-generation Python package and environment manager, written in Rust by Astral. It replaces pip, venv, and pip-tools at the same time, offering a unified and dramatically faster experience. If Python is the engine behind your MCP Servers, uv is the high-performance fuel that keeps everything running smoothly.

💎 Core Concept

O uv is an ultra-fast Python package manager, written in Rust, that combines the features of pip (package installation), venv (virtual environments) and pip-tools (dependency resolution) in a single tool. It resolves and installs dependencies for 10 to 100 times faster than traditional pip, has native lockfiles for reproducible builds, and creates virtual environments automatically when needed.

💡 Practical Tip

Think of uv as the "Python's npm" — a modern tool that manages everything: project creation, package installation, isolated environments, and lockfiles. While pip requires you to create a venv manually, install packages separately, and manage requirements.txt by hand, uv does all of this with simple commands like uv init e uv add.

📊 Data and Research

In real-world benchmarks, uv installs dependencies 10–100x faster than pip. A project with 50 dependencies that takes 45 seconds with pip is resolved in less than 1 second by uv. The project surpassed 30,000 stars on GitHub in less than a year after its launch, and adopted by companies like Pydantic and FastAPI, as well as by the official MCP SDK itself. Astral, the company behind uv, received more than US$ 30 million in investments to develop next-generation Python tools.

4

🔧 Installing uv

Installing uv is quick and straightforward—one command in the terminal is all it takes. uv installs as a standalone binary, without relying on pip or any other previously installed Python tool. That means it works right away, without dependency complications.

💎 Core Concept

uv is distributed as a standalone binary compiled in Rust—it isn't a Python package installed via pip. This eliminates the classic "chicken-and-egg" problem: you don't need pip to install the package manager. The official installation script automatically detects your operating system and architecture, downloads the correct binary, and configures the PATH.

💡 Practical Tip

Installation commands by operating system:

macOS / Linux curl -LsSf https://astral.sh/uv/install.sh | sh
Windows (PowerShell) powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
❌ Avoid
  • •Install uv via pip (pip install uv)
  • •Use outdated versions of uv
  • •Ignore PATH configuration after installation
  • •Mixing pip and uv in the same project
✅ Do
  • •Use the official installation script
  • •Restart the terminal after installing
  • •Check with uv --version
  • •Update regularly with uv self update
5

✅ Verifying the Installation

After installing Python and uv, it’s crucial to check that both tools are working correctly and accessible in the terminal. PATH issues are the most common cause of frustration for beginners — let’s make sure everything is configured before continuing.

💎 Core Concept

A installation check consists of confirming that the commands python e uv are recognized by the terminal and run the correct versions. If a command returns "not recognized" or "command not found," it means the executable is not in the PATH of the system—the list of directories where the terminal looks for programs.

📋 Verification Checklist
Step 1 — Check Python

Execute python --version (or python3 --version on Linux/Mac). It should show Python 3.11.x or higher.

Step 2 — Check uv

Execute uv --version. It should show the installed version (e.g.: uv 0.5.x or higher).

Step 3 — Test uv with Python

Execute uv python list to verify that uv detects the Python installations on your system.

🚨 Alert — Common Problems
  • •"command not found" — PATH is not configured. On Windows, reinstall Python and check "Add to PATH". On Mac/Linux, add the directory to your ~/.bashrc or ~/.zshrc.
  • •Wrong version — If Python 3.9 or 3.10 appears, you have an old version installed. On Linux, use python3.11 explicitly or update it.
  • •Old terminal — Close and reopen the terminal after installation so the PATH changes take effect.
6

🧪 First Test

Now that Python and uv are installed and verified, let’s do a hands-on test: create a Python project with uv and install FastMCP. This test confirms that the entire environment is configured correctly and ready to create MCP Servers.

💎 Core Concept

The command uv init creates a new Python project with the standard structure—including pyproject.toml (project configuration), a directory for source code, and a file .python-version. The command uv add installs packages and automatically registers them as dependencies, creating an isolated virtual environment if needed. Together, these two commands replace all the ceremony of python -m venv + pip install + manual editing of requirements.txt.

💡 Practical Tip

Run the commands below step by step in the terminal:

1. Create the project uv init meu-projeto
2. Enter the folder cd meu-projeto
3. Install FastMCP uv add fastmcp

If FastMCP installs without errors, your environment is 100% ready to create MCP Servers!

❌ Avoid
  • •Install packages globally with pip
  • •Skip FastMCP verification
  • •Create projects without uv init
  • •Ignore installation errors
✅ Do
  • •Always use uv init for new projects
  • •Use uv add instead of pip install
  • •Check that fastmcp appears in pyproject.toml
  • •Commit the uv.lock in Git

📝 Module Summary

  • ✓ Python is the most popular language for MCP Servers, used in 60%+ of community servers.
  • ✓ Python 3.11+ is required for FastMCP — earlier versions cause incompatibilities.
  • ✓ uv is an ultrafast manager that replaces pip, venv, and pip-tools with 10-100x better performance.
  • ✓ uv is installed via the official script—one command in the terminal.
  • ✓ Checking the installation with python --version and uv --version helps prevent future problems.
  • ✓ The uv init + uv add fastmcp test confirms that the environment is ready for MCP.

Next Module: 2.2 — Installing Node.js and npm