| layout | default |
|---|---|
| title | Chapter 1: Getting Started and Scaffolding Workflow |
| nav_order | 1 |
| parent | Create Python Server Tutorial |
create-python-server is a uvx-based scaffolding tool that generates a complete, ready-to-run MCP server project in Python. This chapter covers prerequisites, the generation workflow, and the initial run sequence.
Archive notice: The
modelcontextprotocol/create-python-serverrepository is archived. The scaffold it generates remains functional and the generated pattern (FastMCP or low-level Server API) is still the recommended approach, but the generator itself receives no further updates. See Chapter 8 for migration context.
- Scaffold a new MCP Python server via
uvx create-mcp-server - Understand prerequisites:
uvtoolchain and minimum version check - Run the generated server locally with minimal setup
- Avoid onboarding drift across team environments
The only system requirement is uv at version 0.4.10 or higher. The generator checks this at startup and exits with a clear error if the version is insufficient.
# Verify uv is installed at the right version
uv --version # should be >= 0.4.10
# Install or upgrade uv if needed
curl -LsSf https://astral.sh/uv/install.sh | shuvx is bundled with uv — no separate install step is needed.
flowchart TD
A[Run: uvx create-mcp-server]
A --> B[Generator checks uv version]
B --> C{uv >= 0.4.10?}
C -- No --> FAIL[Exit with install instructions]
C -- Yes --> D[Prompt: project name\nproject description]
D --> E[uv init: create project\nwith pyproject.toml]
E --> F[Add mcp dependency to pyproject.toml]
F --> G[Copy Jinja2 templates:\nserver.py · __init__.py · README.md]
G --> H{Claude Desktop\ninstalled?}
H -- Yes --> CLAUDE[Update claude_desktop_config.json\nautomatically]
H -- No --> DONE[Done: project directory ready]
CLAUDE --> DONE
# Interactive mode — prompts for name and description
uvx create-mcp-server
# Example session:
# Project name: my-notes-server
# Project description: A simple MCP server for managing notes
# Created project at: ./my-notes-serverAfter generation, the project directory contains everything needed to run immediately:
cd my-notes-server
# Install dependencies (creates .venv, installs mcp and dependencies)
uv sync --dev --all-extras
# Run the server in development mode via MCP Inspector
npx @modelcontextprotocol/inspector uv --directory . run my-notes-server
# Or run directly (stdio mode — for Claude Desktop integration)
uv run my-notes-serverThe generator entry point lives in src/create_mcp_server/__main__.py which calls main() from __init__.py. The main function:
- Checks
uvversion viacheck_uv_version()againstMIN_UV_VERSION = "0.4.10" - Prompts for project name and description using
click - Calls
uv init <project-name>as a subprocess to initialize a standard Python project - Modifies the generated
pyproject.tomlto addmcp>=1.0.0as a dependency - Calls
copy_template()to render Jinja2 templates into the project - Optionally calls
update_claude_config()to register the server with Claude Desktop
# From src/create_mcp_server/__init__.py
class PyProject:
def __init__(self, path: Path):
self.data = toml.load(path)
@property
def name(self) -> str:
return self.data["project"]["name"]
@property
def first_binary(self) -> str | None:
scripts = self.data["project"].get("scripts", {})
return next(iter(scripts.keys()), None)The PyProject class reads the generated pyproject.toml to extract the project name and entry-point binary name, which are then used as template variables when rendering server.py.jinja2.
After running uv sync and launching the server via the Inspector, you should see:
- The Inspector browser UI at
localhost:5173 - One tool registered:
add-note - Zero resources initially (resources are note-URI-based; empty at start)
- One prompt:
summarize-notes
# Verify the generated binary runs without errors
uv run my-notes-server --help # if --help is supported, or just check process exits cleanly
# Inspect it interactively
npx @modelcontextprotocol/inspector uv --directory /path/to/my-notes-server run my-notes-serverThe uvx create-mcp-server command scaffolds a complete MCP server project in seconds. The generator verifies uv version, prompts for metadata, runs uv init, installs the mcp dependency, and renders templates from src/create_mcp_server/template/. The result is immediately runnable via uv run <server-name> and testable in the MCP Inspector.
Next: Chapter 2: Generated Project Structure and Conventions