| layout | default |
|---|---|
| title | Chapter 1: Getting Started |
| nav_order | 1 |
| parent | FastMCP Tutorial |
Welcome to Chapter 1: Getting Started. In this part of FastMCP Tutorial: Building and Operating MCP Servers with Pythonic Control, you will build an intuitive mental model first, then move into concrete implementation details and practical production tradeoffs.
This chapter gives you a quick path from installation to a working FastMCP server and first client call.
- create and run a minimal server with one tool
- validate a basic client-server call loop
- understand local stdio versus HTTP first-run choices
- establish a repeatable baseline for future extension
- install FastMCP from the installation guide
- create a minimal server with
FastMCP(...)and one@mcp.tool - run locally using
mcp.run()orfastmcp run ... - call the tool from a client to verify end-to-end behavior
- capture this setup as your baseline template for new services
You now have a reliable baseline for expanding FastMCP servers beyond toy examples.
Next: Chapter 2: Core Abstractions: Components, Providers, Transforms
The from class in scripts/auto_close_needs_mre.py handles a key part of this chapter's functionality:
This script runs on a schedule to automatically close issues that have been
marked as "needs MRE" and haven't received activity from the issue author
within 7 days.
"""
import os
from dataclasses import dataclass
from datetime import datetime, timedelta, timezone
import httpx
@dataclass
class Issue:
"""Represents a GitHub issue."""
number: int
title: str
state: str
created_at: str
user_id: int
user_login: str
body: str | None
@dataclass
class Comment:
"""Represents a GitHub comment."""
id: int
body: strThis class is important because it defines how FastMCP Tutorial: Building and Operating MCP Servers with Pythonic Control implements the patterns covered in this chapter.
The class class in scripts/auto_close_needs_mre.py handles a key part of this chapter's functionality:
import os
from dataclasses import dataclass
from datetime import datetime, timedelta, timezone
import httpx
@dataclass
class Issue:
"""Represents a GitHub issue."""
number: int
title: str
state: str
created_at: str
user_id: int
user_login: str
body: str | None
@dataclass
class Comment:
"""Represents a GitHub comment."""
id: int
body: str
created_at: str
user_id: int
user_login: str
This class is important because it defines how FastMCP Tutorial: Building and Operating MCP Servers with Pythonic Control implements the patterns covered in this chapter.
The class class in scripts/auto_close_needs_mre.py handles a key part of this chapter's functionality:
import os
from dataclasses import dataclass
from datetime import datetime, timedelta, timezone
import httpx
@dataclass
class Issue:
"""Represents a GitHub issue."""
number: int
title: str
state: str
created_at: str
user_id: int
user_login: str
body: str | None
@dataclass
class Comment:
"""Represents a GitHub comment."""
id: int
body: str
created_at: str
user_id: int
user_login: str
This class is important because it defines how FastMCP Tutorial: Building and Operating MCP Servers with Pythonic Control implements the patterns covered in this chapter.
The class class in scripts/auto_close_needs_mre.py handles a key part of this chapter's functionality:
import os
from dataclasses import dataclass
from datetime import datetime, timedelta, timezone
import httpx
@dataclass
class Issue:
"""Represents a GitHub issue."""
number: int
title: str
state: str
created_at: str
user_id: int
user_login: str
body: str | None
@dataclass
class Comment:
"""Represents a GitHub comment."""
id: int
body: str
created_at: str
user_id: int
user_login: str
This class is important because it defines how FastMCP Tutorial: Building and Operating MCP Servers with Pythonic Control implements the patterns covered in this chapter.
flowchart TD
A[from]
B[class]
C[class]
D[class]
E[GitHubClient]
A --> B
B --> C
C --> D
D --> E