तुम रोज़ Claude या ChatGPT इस्तेमाल करते हो। अच्छे भी हो — prompts, follow-ups, पूरा नाच-गाना। लेकिन जैसे ही तुम्हें अपनी कंपनी के CRM, project tracker, या internal database से data चाहिए, तुम एक human USB cable बन जाते हो: browser tab A से copy, chatbot tab B में paste, repeat — जब तक आत्मा शरीर छोड़ न दे।

यहाँ एक बात है जो ज़्यादातर tutorials सीधे नहीं बोलते: "AI जो internet जानता है" और "AI जो तुम्हारा business जानता है" — इन दोनों के बीच का gap बस एक Python file का है। कोई platform migration नहीं। कोई लाखों का vendor contract नहीं। एक file जिसमें एक decorator और एक docstring है। Protocol पहले से exist करता है, हर major AI company ने adopt कर लिया है, और तुम एक दोपहर में set up कर सकते हो। दिखाता हूँ।

obvious solutions काम क्यों नहीं करते

"बस API use कर लो" — बढ़िया advice, बस एक problem है कि तुम्हारे AI के हाथ नहीं हैं। वो तुम्हारी company का REST API (एक URL जो data return करता है जब तुम अच्छे से पूछो) खुद से call नहीं कर सकता। तुम API docs chat में paste कर सकते हो, लेकिन वो context window खा जाएगा — AI एक बार में कितना text "देख" सकता है, उसकी working memory — और copying तो तुम ही कर रहे हो। Zapier जैसे integrations हैं, लेकिन rigid हैं: predefined triggers, predefined actions, और pricing page देखकर तुम्हारे CFO को heart attack आ जाए।

तुम्हें असल में जो चाहिए वो ये है कि AI खुद तुम्हारे internal tools discover और call कर सके — बिना तुम्हारे बिचौलिया बने।

MCP: वो standard जिसने ये solve किया

MCP (Model Context Protocol) AI tools के लिए एक universal plug standard है — सोचो USB-C, लेकिन AI को तुम्हारे data से connect करने के लिए। Anthropic ने इसे November 2024 में open-source किया। March 2026 तक, 97 million monthly SDK downloads हो गए। OpenAI, Google, और Microsoft सबने adopt किया। 26 April 2026 तक, registries में 17,000 से ज़्यादा MCP servers indexed हैं।

Python SDK से तुम एक single file में working server बना सकते हो। ऐसे।

Step 1: SDK install करो

तुम्हें Python 3.10+ चाहिए और या तो uv (Anthropic का recommended package manager) या plain pip

# Option A: uv (recommended)
uv init my-mcp-server && cd my-mcp-server
uv add "mcp[cli]" httpx

# Option B: pip
pip install "mcp[cli]" httpx

httpx एक Python HTTP library है — इसी से तुम्हारा server external APIs से data fetch करता है। अगर तुम्हारा data database में है, तो इसकी जगह अपना database driver लगाओ।

Step 2: Server लिखो

server.py बनाओ। यहाँ एक complete MCP server है जो US National Weather Service से weather alerts fetch करता है — real API, कोई auth key नहीं चाहिए, सीखने के लिए perfect:

from typing import Any
import httpx
from mcp.server.fastmcp import FastMCP

# FastMCP — एक high-level wrapper जो
# plain Python functions को MCP tools में बदल देता है
mcp = FastMCP("weather")

NWS_API_BASE = "https://api.weather.gov"

async def make_request(url: str) -> dict[str, Any] | None:
    headers = {
        "User-Agent": "mcp-weather-demo/1.0",
        "Accept": "application/geo+json",
    }
    async with httpx.AsyncClient() as client:
        try:
            response = await client.get(
                url, headers=headers, timeout=30.0
            )
            response.raise_for_status()
            return response.json()
        except Exception:
            return None

@mcp.tool()
async def get_alerts(state: str) -> str:
    """Get active weather alerts for a US state.

    Args:
        state: Two-letter US state code (e.g. CA, NY)
    """
    data = await make_request(
        f"{NWS_API_BASE}/alerts/active/area/{state}"
    )
    if not data or "features" not in data:
        return "No alerts found."

    alerts = []
    for feature in data["features"][:5]:
        props = feature["properties"]
        alerts.append(
            f"Event: {props.get('event', 'Unknown')}\n"
            f"Area: {props.get('areaDesc', 'Unknown')}\n"
            f"Severity: {props.get('severity', 'Unknown')}"
        )
    return "\n---\n".join(alerts) or "No active alerts."

if __name__ == "__main__":
    mcp.run(transport="stdio")

कुल मिलाकर 40 lines real code। @mcp.tool() decorator — एक Python shorthand जो तुम्हारे function को AI-callable tool के रूप में register करता है — भारी lifting करता है। FastMCP तुम्हारे type hints (state: str) और docstring (triple-quoted description) पढ़कर automatically tool definitions generate करता है जो AI समझ सकता है।

यही core pattern है। जो भी MCP server तुमने कभी देखा है — Slack, GitHub, Figma, सभी 17,000+ — यही skeleton है बस ज़्यादा endpoints के साथ।

Step 3: Claude Desktop से connect करो

Claude Desktop एक JSON config file (एक specific format में settings file) पढ़ता है ताकि उसे पता चले कौन से MCP servers launch करने हैं। ये यहाँ मिलेगी:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

बनाओ या edit करो:

{
  "mcpServers": {
    "weather": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/my-mcp-server",
        "run",
        "server.py"
      ]
    }
  }
}

/absolute/path/to/my-mcp-server को actual full path से replace करो। Relative paths काम नहीं करते — पहली बार ये सबको फँसाता है।

Claude Desktop restart करो। Chat input के bottom-right में hammer icon देखो। Click करो — get_alerts listed दिखना चाहिए। अगर नहीं दिखा, तो macOS पर ~/Library/Logs/Claude/mcp*.log check करो errors के लिए।

Step 4: Claude से कुछ पूछो

Type करो: "Are there any weather alerts in California right now?"

Claude पहचान लेगा कि उसके पास get_alerts tool है, तुमसे permission माँगेगा call करने की, तुम्हारे server को hit करेगा, और live NWS data के साथ respond करेगा जो पाँच मिनट पहले उसके पास नहीं था।

यही वो "aha" moment है। तुम्हारा chatbot अब generic नहीं रहा।

Step 5: Weather API को अपने API से replace करो

अब make_request को swap करो — Jira, Linear, तुम्हारा internal dashboard, कुछ भी जो तुम्हारी team use करती है। अगर उसके पास एक endpoint है जो data return करता है, तो वो एक function दूर है AI tool बनने से। Pattern हमेशा यही है:

  1. एक async function लिखो जो data fetch करे
  2. @mcp.tool() से decorate करो
  3. Clear docstring लिखो (नीचे बता रहा हूँ ये क्यों important है)
  4. Config में add करो, restart करो

कुछ design principles जो useful MCP tools को frustrating वालों से अलग करती हैं: अपने tools को verb-noun pairs से name करो (get_alerts, search_tickets, create_issue) ताकि model सिर्फ़ नाम से intent समझ सके। हर tool को एक action पर focused रखो — एक function जो fetch भी करे, filter भी करे, और write back भी करे, वो तीन tools हैं जो एक होने का नाटक कर रहे हैं। और parameter design के लिए, explicit typed arguments prefer करो catch-all strings के बजाय; state: str जिसका docstring बोले "Two-letter US state code" — model को इतना काफ़ी है अपना input validate करने के लिए।

Gotchas जो काटेंगे

1. तुम्हारी tool description ही product है

Queen's University की February 2026 की study ने 103 servers के 856 MCP tools analyze किए। Result: 97.1% tool descriptions में कम से कम एक quality defect था। 56% ने तो अपना purpose भी ठीक से नहीं बताया। जब researchers ने descriptions improve कीं, task success rates +5.85 percentage points बढ़ गए। तुम्हारा docstring documentation नहीं है — ये वो UI है जो तुम्हारा AI पढ़ता है। इसे product spec की तरह लिखो: purpose, parameter explanations, limitations, examples।

2. कभी stdout पर print() मत करो

stdio-based servers के लिए (जो Claude Desktop use करता है), stdout पर लिखना JSON-RPC messages corrupt कर देता है — वो protocol जिससे तुम्हारा AI और server communicate करते हैं। Server चुपचाप टूट जाता है और तुम 45 मिनट खाली screen घूरते रहते हो। print("debug", file=sys.stderr) या Python का logging module use करो।

3. Security तुम्हारी ज़िम्मेदारी है

MCP में local servers के लिए built-in authentication नहीं है। stdio से तुम्हारे laptop पर चलने तक ठीक है — बस एक local process है। लेकिन जिस moment तुम इसे HTTP पर expose करने की सोचो: रुको। OWASP MCP Top 10, जो early 2026 में publish हुआ, इसलिए exist करता है क्योंकि लोगों ने ये step skip किया। सिर्फ़ January–February 2026 में MCP tooling के खिलाफ़ 30 से ज़्यादा CVEs आए। खुद FastMCP में एक command injection vulnerability थी (CVE-2025-64340, late 2025 में disclosed) — version 3.2.0 से नीचे सब affected।

अगर तुम्हारा server internal APIs touch करता है, तो इसे किसी भी backend service की तरह treat करो: हर input validate करो जो model भेजे (वो parameter values hallucinate करेगा — पक्का मानो), least-privilege access enforce करो ताकि हर tool सिर्फ़ ज़रूरी data तक पहुँच सके, और dependencies pin करो। Local-only stdio ही safe default है जब तक तुमने auth properly solve नहीं किया।

4. Config path absolute होना चाहिए

claude_desktop_config.json में relative paths silently fail होते हैं। कोई error नहीं, कोई log नहीं, बस hammer icon ग़ायब और developer धीरे-धीरे भगवान से भरोसा उठाता जा रहा है। macOS पर /Users/yourname/... use करो — tilde expansion यहाँ भरोसेमंद नहीं है।

अब तुम क्या कर सकते हो

तुम्हारे पास एक repeatable pattern है। कोई भी API जो तुम्हारी team पहले से use करती है — project tracker, CRM, internal dashboard, database — एक Python file दूर है AI-queryable बनने से। कोई vendor integration waitlist नहीं। कोई Zapier tax नहीं। 2019 की तरह tabs के बीच copy-paste नहीं।

"AI जो internet जानता है" और "AI जो तुम्हारा business जानता है" — इन दोनों के बीच की दीवार में अब एक दरवाज़ा है। तुमने इसे एक typical config file से भी कम lines में बना दिया।