Model Context Protocol

beginner Deck 16 slides

Your agent doesn't know what it doesn't know. MCP is how you teach it.

Model Context Protocol

Your agent doesn’t know what it doesn’t know.

MCP is how you teach it.

The Brief

You’re packing for a trip. You open Cursor and ask:

plaintext
"what's the weather in Colombo right now?"

The agent is fast. It’s confident. It’s about to be wrong.

Attempt 1 — Ask the Agent

You type the obvious thing. The agent answers immediately.

plaintext
> what's the weather in Colombo right now?

It's currently around 29°C and partly cloudy in Colombo,
with humidity near 80% — typical for this time of year.

Confident. Specific. Useful-sounding.

Now open your weather app.

Why Did That Happen?

The LLM was trained on public text — months or years ago.

What it hasWhat it doesn’t
The climate profile of ColomboThe weather right now
Average rainfall by monthToday’s forecast
Plausible-sounding numbersA way to actually look

The Pattern

Anything that lives outside the weights is invisible to the model.

Live State

Weather, stock prices, deploy status, on-call rotation — anything “right now”.

Your Systems

Your Jira, your Linear, your DB. None of it is in the training data.

Private APIs

Internal services behind your VPN. The model has never seen them.

Anything Post-Cutoff

Events, releases, prices, news after the training date.

Every one of these is a place the agent will hallucinate if you ask.

The Pivot

We don’t need a smarter model. We need to hand the model a way to look things up.

  1. Expose a real source as a tool

    Wrap a weather API in something the agent can call.

  2. Speak a protocol the agent understands

    So any agent — Cursor, Claude, Copilot — can use it.

  3. Let the agent decide when to call it

    No prompt engineering. The agent picks the tool by name and description.

That protocol is MCP — the Model Context Protocol.

What Is MCP?

An open protocol that connects AI agents to tools and data — over a standard interface.

One Protocol

USB-C for AI tools. Build once, plug into any MCP-compatible client.

Three Primitives

Tools (functions the agent calls), resources (data it reads), prompts (templates it uses).

Client + Server

Cursor is the client. Your weather wrapper is the server. The agent in between picks the tool.

The Shape of the Fix

plaintext
┌──────────┐    MCP     ┌─────────────┐   HTTP   ┌──────────────┐
│  Cursor  │ ─────────▶ │ Weather MCP │ ──────▶  │ open-meteo   │
│ (client) │            │ Server      │          │  (free API)  │
└──────────┘            │ get_weather │          └──────────────┘
                        └─────────────┘

The MCP server is yours. It knows how to talk to the weather API. It tells the agent: “I have a tool called get_weather. Give me a city, I’ll give you the current conditions.”

The agent now has a way to look up instead of guessing.

Build the MCP Server

The Python SDK makes this almost trivial. One file. One tool. No API key — open-meteo is free.

bash
pip install mcp httpx
python
# weather_server.py
import httpx
from mcp.server.fastmcp import FastMCP

mcp = FastMCP("weather")

@mcp.tool()
def get_weather(city: str) -> dict:
    """Get the current weather for a city.
    Returns temperature in Celsius, wind speed, and a condition code."""
    geo = httpx.get(
        "https://geocoding-api.open-meteo.com/v1/search",
        params={"name": city, "count": 1},
    ).json()
    if not geo.get("results"):
        return {"error": f"City not found: {city}"}

    lat, lon = geo["results"][0]["latitude"], geo["results"][0]["longitude"]
    now = httpx.get(
        "https://api.open-meteo.com/v1/forecast",
        params={"latitude": lat, "longitude": lon, "current_weather": True},
    ).json()["current_weather"]

    return {
        "city":        city,
        "temperature": now["temperature"],
        "wind_kph":    now["windspeed"],
        "condition":   now["weathercode"],
    }

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

Wire It Into Cursor

Cursor reads MCP servers from a config file. One entry per server.

json
// ~/.cursor/mcp.json
{
  "mcpServers": {
    "weather": {
      "command": "python",
      "args": ["/path/to/weather_server.py"]
    }
  }
}

Restart Cursor. The weather server shows up under MCP Tools. The agent now sees get_weather in its toolbox.

Attempt 2 — Ask Again

Same question. Same model. Different result.

plaintext
> what's the weather in Colombo right now?

[calling tool: weather.get_weather(city="Colombo")]

Currently in Colombo: 24°C, wind 18 km/h, condition code 63
(moderate rain). Pack an umbrella.

The agent didn’t guess. It noticed the question was about current weather, found a tool whose description matched, called it, and used the result.

What Just Happened

  1. Tool discovery

    On startup, Cursor asked the MCP server “what can you do?” The server replied with the tool list and descriptions.

  2. Intent matching

    When the user asked about Colombo weather, the agent matched the question against tool descriptions and picked get_weather.

  3. Invocation

    The agent called the tool with city="Colombo". The MCP server hit the weather API and returned structured JSON.

  4. Grounded answer

    The agent answered using the tool’s response — not its imagination.

What MCP Buys You

One Server, Many Clients

Write the weather server once. Cursor, Claude Desktop, and Claude Code all use it.

Reusable Toolboxes

Add a tool to your server — every client picks it up. No client-side changes.

Discoverability Built-In

The agent learns your tools from descriptions. No prompt engineering per question.

You Own the Boundary

Auth, rate limits, scopes live in your server — not in the prompt.

Beyond One Tool

get_weather is the first rung. The same server can grow.

ToolWhat it does
get_weather(city)Current conditions for a city
get_forecast(city, days)Multi-day forecast
get_alerts(region)Severe weather alerts
compare_cities(a, b)Side-by-side conditions for trip planning

Same pattern for any source the model can’t reach: Jira, GitHub, Postgres, your feature flags, your deploy pipeline.

The Takeaways

Missing Context = Hallucination

When the model has no access, it generates plausible text instead of refusing.

MCP Fills the Gap

A standard protocol for connecting agents to tools and data.

Servers Are Small

One Python file, one decorated function, one config entry. That’s the floor.

It Scales By Composition

Add tools, add servers. Every MCP-aware client gets them for free.

What’s Next

1 / 16