0Pricing
MCP Academy · Lección

Crear una instancia de FastMCP

Inicie un objeto de servidor con nombre en pocas líneas.

Crear una instancia de FastMCP es una lección gratuita de MCP Academy en CoddyKit. Esta es la lección 1 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de MCP Academy, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de MCP Academy incluye 4 lecciones en total.

Partes de esta lección aún no han sido traducidas y se muestran en 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! 🎉

Preguntas frecuentes

¿La lección «Crear una instancia de FastMCP» es gratis?

Sí — el texto completo de «Crear una instancia de FastMCP» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de MCP Academy, actualiza a CoddyKit PRO. El curso de MCP Academy incluye 4 lecciones en total.

¿Qué aprenderé en «Crear una instancia de FastMCP»?

Inicie un objeto de servidor con nombre en pocas líneas. Practicas MCP Academy con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.

¿Necesito experiencia previa para empezar MCP Academy?

No se requiere experiencia previa. MCP Academy en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 1 de 4.

¿Cuánto tiempo toma la lección «Crear una instancia de FastMCP»?

La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.

¿Puedo escribir y ejecutar código en esta lección de MCP Academy?

Sí. Cada lección de MCP Academy incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.

Todas las lecciones de este curso

  1. Crear una instancia de FastMCP
  2. Añadir una herramienta Hello
  3. Ejecutar el servidor con stdio
  4. Confirmar que carga y muestra las herramientas
← Volver a MCP Academy