إنشاء مثيل FastMCP
أنشئوا كائن خادم مسمّى باستخدام بضعة أسطر.
إنشاء مثيل FastMCP درس مجاني في MCP Academy على CoddyKit. هذا هو الدرس 1 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في 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 FastMCPCreate 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/7) وفتح باقي دورة MCP Academy، انتقل إلى CoddyKit PRO. تتضمن دورة MCP Academy 4 دروس في المجموع.
ماذا ستتعلم في «إنشاء مثيل FastMCP»؟
أنشئوا كائن خادم مسمّى باستخدام بضعة أسطر. تتمرن على MCP Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ MCP Academy؟
لا تُشترط خبرة سابقة. MCP Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 1 من أصل 4.
كم من الوقت يستغرق درس «إنشاء مثيل FastMCP»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس MCP Academy هذا؟
نعم. كل درس في MCP Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.