Deprecated features
मशीनी अनुवाद
यह page अंग्रेज़ी documentation से अपने-आप अनुवादित किया गया है, और अंग्रेज़ी page ही प्रामाणिक version है। अगर कुछ गलत लगे, तो अनुवाद page बताता है कि इसकी सूचना कैसे दें।
2026-07-28 spec पाँच चीज़ों को retire करता है। SDK अब भी इनमें से हर एक को implement करता है, और अब हर एक पर deprecation warning लगी है।
नीचे दी गई table हर deprecated feature का नाम, उसके हटने की वजह, और उसकी जगह किस पर build करना है, यह बताती है।
क्या deprecated है
| Deprecated | क्यों | इसके बजाय क्या करें |
|---|---|---|
Roots: ctx.session.list_roots(), client.send_roots_list_changed(), Client(...) को दिया जाने वाला list_roots_callback= |
SEP-2577 इस capability को retire करता है। | paths को साधारण tool arguments या resource URIs के रूप में लें, या InputRequiredResult में ListRootsRequest embed करें (Multi-round-trip requests देखें)। |
Server-initiated sampling: ctx.session.create_message(), Client(...) को दिया जाने वाला sampling_callback= |
SEP-2577 इस capability को retire करता है। | InputRequiredResult लौटाएँ और client को call retry करने दें (Multi-round-trip requests देखें)। |
Protocol logging: ctx.log(), ctx.debug(), ctx.info(), ctx.warning(), ctx.error(), ctx.session.send_log_message(), client.set_logging_level() |
SEP-2577 इस capability को retire करता है। protocol के अंदर इसकी जगह कुछ नहीं लेता। | stderr पर साधारण import logging (Logging देखें)। |
ping: client.send_ping() |
protocol से हटा दिया गया, सिर्फ़ deprecated नहीं। 2026-07-28 में कोई ping method नहीं है। |
कुछ नहीं। यह सिर्फ़ mode="legacy" connection पर काम करता है। |
Client->server progress: client.send_progress_notification() |
2026-07-28 progress को सिर्फ़ server->client बनाता है। | भेजने को कुछ नहीं। आपका server ctx.report_progress() से progress report करता है (Progress देखें)। |
इस table से तीन बातें निकलती हैं:
- roots, sampling और logging साथ-साथ जाते हैं। एक ही proposal, SEP-2577, तीनों capabilities को एक साथ deprecate करता है।
- sampling और roots की एक गहरी साझा समस्या है: ये वे जगहें हैं जहाँ server client को request भेजता है। यही वह पूरी दिशा है जिसे 2026-07-28 Multi-round-trip requests से बदलता है। जो गए हैं वे standalone RPC methods हैं (
sampling/createMessage,roots/list, और push-styleelicitation/create);CreateMessageRequest/ListRootsRequest/ElicitRequestpayload types बचे रहते हैं,InputRequiredResult.input_requestsमें embed होकर, और client पर वे उन्हीं callbacks तक पहुँचते हैं। pingबाकियों से अलग है। protocol इसे deprecate नहीं करता, हटा देता है। SDK method अब भी warn करता है (उसका message removed कहता है, deprecated नहीं) और modern connection पर इसे call करने पर जवाब "Method not found" आता है।
Deprecated होना बस सलाह भर है
आज कुछ नहीं टूटता।
ऊपर का हर method ऐसे किसी भी session पर काम करता रहता है जिसने 2025-11-25 या उससे पहले का version negotiate किया हो। client पर mode="legacy" pin करें और आपको ठीक 2026 से पहले वाला व्यवहार मिलता है। wire में कोई बदलाव नहीं है और capability negotiation जस का तस है।
बदलता यह है कि हर एक के पहली बार चलने पर आपको साफ़ दिखने वाली warning मिलती है:
MCPDeprecationWarning: The logging capability is deprecated as of 2026-07-28 (SEP-2577).
MCPDeprecationWarning UserWarning का subclass है, DeprecationWarning का नहीं। यह जानबूझकर है: Python का default filter DeprecationWarning को सिर्फ़ उसी code में दिखाता है जो सीधे __main__ के रूप में चलता है, और इसी तरह libraries चीज़ें deprecate करती हैं और दो साल तक किसी को पता नहीं चलता। यह वाली हर जगह दिखती है, बिना किसी -W flag के।
Warning
"बस सलाह" वाली बात wire पर आकर खत्म हो जाती है। sampling और roots server-से-client
requests हैं, और 2026-07-28 session के पास इन्हें ले जाने का कोई channel नहीं है। modern
connection पर tool के अंदर ctx.session.create_message() call करें तो warning फिर भी
fire होती है, और फिर send एक error के साथ fail हो जाता है:
Cannot send 'sampling/createMessage': this transport context has no back-channel
for server-initiated requests.
दो संकेत, इसी क्रम में। MCPDeprecationWarning उसी पल fire होती है जब आप method call
करते हैं, किसी भी connection पर। error वह है जो तब वापस आता है जब SDK उसे भेजने की
कोशिश करता है। ये दोनों end-to-end सिर्फ़ ऐसे mode="legacy" connection पर काम करते हैं
जिसके client ने matching callback register किया हो।
warning को चुप कराना
नए code में ऐसा न करें।
लेकिन जिस server की आप देखरेख करते हैं और जो सच में 2026 से पहले के clients को serve करता है, उसे शांत log का पूरा हक है। पहला deprecated call चलने से पहले इस category को filter करें:
import warnings
from mcp import MCPDeprecationWarning
warnings.filterwarnings("ignore", category=MCPDeprecationWarning)
पूरा API बस इतना ही है। हर method के लिए अलग switch नहीं है, और आपको चाहिए भी नहीं: एक category का मतलब ही यह है कि एक line उसे चुप कराती है और एक line उसे वापस ले आती है।
Check
filter को उल्टा चलाएँ और आपको मुफ़्त में regression test मिलता है। अपनी pytest
configuration की filterwarnings setting में "error::mcp.MCPDeprecationWarning"
जोड़ें और deprecated call warn करने के बजाय raise करता है। old_log नाम का tool
जो अब भी ctx.info() call करता है, pass होना बंद कर देता है और यह report करने लगता है:
Error executing tool old_log: The logging capability is deprecated as of 2026-07-28 (SEP-2577).
pytest configuration की एक line, और कोई deprecated call बिना test fail किए आपके codebase में चुपके से वापस नहीं आ सकता।
सारांश
- 2026-07-28 spec roots, server-initiated sampling, और protocol logging को deprecate करता है (तीनों SEP-2577), progress को server-से-client तक सीमित करता है, और
pingको हटा देता है। - replacement वाला column आपको आगे का रास्ता दिखाता है: sampling और roots के लिए Multi-round-trip requests, logging के लिए Logging, progress के लिए Progress।
pingको कुछ भी नहीं चाहिए। - Deprecated होना बस सलाह भर है: wire में कोई बदलाव नहीं, 2026 से पहले के sessions पर सब कुछ काम करता रहता है, और आपको साफ़ दिखने वाली
MCPDeprecationWarningमिलती है (यहUserWarningहै, इसलिए default रूप से चालू है)। - sampling और roots को इसके अलावा back-channel चाहिए जो 2026-07-28 session के पास नहीं है। modern connection पर ये warn करते हैं और फिर raise करते हैं।
warnings.filterwarnings("ignore", category=MCPDeprecationWarning)पूरी category को चुप कराता है; pytest में"error::mcp.MCPDeprecationWarning"इसे test failure में बदल देता है।- नया code इनमें से किसी पर भी नहीं बनना चाहिए।
इन docs का बाकी हर page मौजूदा API सिखाता है।