0Pricing
MCP Academy · Aula

Criar uma instância FastMCP

Inicialize um objeto de servidor nomeado em poucas linhas.

Criar uma instância FastMCP é uma aula grátis de MCP Academy no CoddyKit. Esta é a aula 1 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de MCP Academy, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de MCP Academy inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

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

Perguntas Frequentes

A aula “Criar uma instância FastMCP” é grátis?

Sim — o texto completo de “Criar uma instância FastMCP” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de MCP Academy, atualize para CoddyKit PRO. O curso de MCP Academy inclui 4 aulas no total.

O que vou aprender em “Criar uma instância FastMCP”?

Inicialize um objeto de servidor nomeado em poucas linhas. Você pratica MCP Academy com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar MCP Academy?

Nenhuma experiência prévia é necessária. MCP Academy no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 1 de 4.

Quanto tempo leva a aula “Criar uma instância FastMCP”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de MCP Academy?

Sim. Cada aula de MCP Academy inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. Criar uma instância FastMCP
  2. Adicionar uma ferramenta Hello
  3. Executar o servidor com stdio
  4. Confirmar carregamento e listagem das ferramentas
← Voltar para MCP Academy