نقل HTTP القابل للبث
تعلّموا كيفية تشغيل MCP عبر نقطة نهاية HTTP واحدة.
نقل HTTP القابل للبث درس مجاني في MCP Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في MCP Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة MCP Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Meet Streamable HTTP
MCP's modern remote transport is called Streamable HTTP. It lets your server live behind one web URL that any client on the internet can reach.
One Endpoint to Rule Them All
Unlike older designs, Streamable HTTP uses a single endpoint, often something like /mcp. Both requests and replies flow through that one path.
POST https://api.example.com/mcpClients POST Their Messages
To call a tool, the client sends a normal HTTP POST to the endpoint. The body is the same JSON-RPC message you already learned about. 📨
Two Ways to Answer
The server can reply in two shapes: a plain JSON response for quick calls, or an event stream when it wants to send results bit by bit.
The Accept Header Decides
The client's Accept header signals what it can handle. Listing both JSON and the event-stream type lets the server choose the best reply format.
Accept: application/json, text/event-streamIt Is Still JSON-RPC
The transport changed, but the language did not. Every message over HTTP is the same JSON-RPC request, response, or notification you met earlier.
Turning On HTTP in the SDK
With the Python SDK you flip one switch: run your server with the streamable-http transport instead of stdio. The tools stay exactly the same.
mcp.run(transport="streamable-http")It Speaks Plain HTTP
Because it is ordinary HTTP, it plays nicely with the whole web stack: load balancers, proxies, and TLS all work without anything special. 🌐
Stateful or Stateless
Streamable HTTP can run stateful, remembering a session, or stateless, treating each call fresh. You choose based on how your server holds context.
It Replaced an Older Transport
An earlier HTTP+SSE design used two separate paths and was clunkier. Streamable HTTP replaced it as the recommended way to serve MCP remotely.
Why It Matters
This single-endpoint design is what makes a remote MCP server practical to deploy and easy for any client to connect to from anywhere.
Quick Check
How does a client send a tool call over Streamable HTTP?
Recap: Streamable HTTP
Streamable HTTP serves MCP over one HTTP endpoint: clients POST JSON-RPC, and the server answers with JSON or a live event stream. Same logic, remote reach. 🚀
الأسئلة الشائعة
هل درس «نقل HTTP القابل للبث» مجاني؟
نعم — نص درس «نقل HTTP القابل للبث» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة MCP Academy، انتقل إلى CoddyKit PRO. تتضمن دورة MCP Academy 4 دروس في المجموع.
ماذا ستتعلم في «نقل HTTP القابل للبث»؟
تعلّموا كيفية تشغيل MCP عبر نقطة نهاية HTTP واحدة. تتمرن على MCP Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ MCP Academy؟
لا تُشترط خبرة سابقة. MCP Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.
كم من الوقت يستغرق درس «نقل HTTP القابل للبث»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس MCP Academy هذا؟
نعم. كل درس في MCP Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- لماذا لا يكفي stdio
- نقل HTTP القابل للبث
- بث الاستجابات باستخدام SSE
- الجلسات وإعادة الاتصال