0Pricing
MCP Academy · Lektion

Eine FastMCP-Instanz erstellen

Starten Sie mit wenigen Zeilen ein benanntes Serverobjekt.

Eine FastMCP-Instanz erstellen ist eine kostenlose MCP Academy-Lektion auf CoddyKit. Dies ist Lektion 1 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des MCP Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der MCP Academy-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

Meet FastMCP

Time to build for real! The Python SDK gives you FastMCP, a friendly class that turns plain functions into a working MCP server. 🚀

Import It First

Everything starts with one import. You pull FastMCP from the official package so the rest of your file has it ready to use.

from mcp.server.fastmcp import FastMCP

Create the Instance

Now you make a server instance. Calling FastMCP(...) hands you back one object that will hold every tool you add later.

mcp = FastMCP("demo")

Give It a Name

That first string is your server's name. Clients show it to users, so pick something clear like "weather" or "notes" instead of "app1".

mcp = FastMCP("weather")

The mcp Object Is Your Hub

That mcp variable is the hub of your whole server. You attach tools, resources, and prompts to it, then ask it to run.

Why It's Called Fast

FastMCP is fast because it hides the protocol plumbing. You write normal Python, and it generates the JSON-RPC schemas behind the scenes.

Almost a Whole Server

Believe it or not, these two lines are already a valid server skeleton. It just has no tools yet, so it can't do anything useful so far.

from mcp.server.fastmcp import FastMCP
mcp = FastMCP("demo")

Add an Optional Description

You can pass extra hints too. Some setups accept an instructions string that tells clients what the server is for at a glance.

mcp = FastMCP("weather", instructions="Look up forecasts.")

One Server Per File

A common pattern is one module holding a single mcp instance. It keeps each server small, focused, and easy to reason about.

Naming Stays Stable

Try to keep your server name stable over time. Clients and configs reference it, so renaming later means updating every place that points at it.

Nothing Runs Yet

Creating the instance does not start a server. It just builds the object in memory; starting it is a separate step you'll meet soon.

Quick Check

Let's lock in what the constructor argument does.

Recap

You imported FastMCP, created an mcp instance, and gave it a clear name. That object is the hub every capability will hang off. Next: a real tool! 🎉

Häufig gestellte Fragen

Ist die Lektion „Eine FastMCP-Instanz erstellen“ kostenlos?

Ja — der vollständige Text von „Eine FastMCP-Instanz erstellen“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des MCP Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der MCP Academy-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Eine FastMCP-Instanz erstellen“?

Starten Sie mit wenigen Zeilen ein benanntes Serverobjekt. Du übst MCP Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um MCP Academy zu starten?

Keine Vorkenntnisse erforderlich. MCP Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 1 von 4.

Wie lange dauert die Lektion „Eine FastMCP-Instanz erstellen“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser MCP Academy-Lektion Code schreiben und ausführen?

Ja. Jede MCP Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. Eine FastMCP-Instanz erstellen
  2. Ein Hello-Tool hinzufügen
  3. Den Server mit stdio ausführen
  4. Laden und Auflisten der Tools bestätigen
← Zurück zu MCP Academy