Set up Python 3.11+ and the uv package manager—the basic tools for creating MCP Servers in Python.
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.
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.
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.
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.
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.
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.
Install via Homebrew: brew install python. Homebrew already configures the PATH automatically. If you don't have Homebrew, install it first at brew.sh.
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.
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.
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.
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.
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.
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.
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.
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.
Installation commands by operating system:
curl -LsSf https://astral.sh/uv/install.sh | sh
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
pip install uv)uv --versionuv self updateAfter 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.
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.
Execute python --version (or python3 --version on Linux/Mac). It should show Python 3.11.x or higher.
Execute uv --version. It should show the installed version (e.g.: uv 0.5.x or higher).
Execute uv python list to verify that uv detects the Python installations on your system.
~/.bashrc or ~/.zshrc.python3.11 explicitly or update it.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.
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.
Run the commands below step by step in the terminal:
uv init meu-projeto
cd meu-projeto
uv add fastmcp
If FastMCP installs without errors, your environment is 100% ready to create MCP Servers!
uv inituv init for new projectsuv add instead of pip installuv.lock in GitNext Module: 2.2 — Installing Node.js and npm