0Pricing
MCP Academy · レッスン

FastMCPインスタンスを作成する

数行のコードで名前付きのサーバーオブジェクトを起動します。

「FastMCPインスタンスを作成する」はCoddyKit上の無料MCP Academyレッスンです。 これはレッスン1/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはMCP Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 MCP Academyコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

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! 🎉

よくある質問

「FastMCPインスタンスを作成する」レッスンは無料ですか?

はい。「FastMCPインスタンスを作成する」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、MCP Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 MCP Academyコースには全4レッスンが含まれています。

「FastMCPインスタンスを作成する」で何を学びますか?

数行のコードで名前付きのサーバーオブジェクトを起動します。 ブラウザで直接実行するハンズオンコードでMCP Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

MCP Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのMCP Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン1/4です。

「FastMCPインスタンスを作成する」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このMCP Academyレッスンでコードを書いて実行できますか?

はい。すべてのMCP Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. FastMCPインスタンスを作成する
  2. Helloツールを追加する
  3. stdioでサーバーを実行する
  4. 読み込みとツール一覧を確認する
← MCP Academyに戻る