Model Context ProtocolMCP Python SDK 2.2 · LangChain 1.4 · Python 3.10+
Dashboard
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
27 small wins to finish your pathNext lesson →

MCP hosts

A host is the application that runs your server and connects a model to it, such as Claude Code, Claude Desktop or Cursor.

Last updated: 29 Sep, 2026 · MCP 2.2

Run these steps yourself: they change the settings of applications on your own computer.

Claude Desktop and Cursor · from the MCP Agentic AI Crash Course With Python · 35:09 to 39:24

The MCP crash course connects its weather server to two hosts. uv run mcp install server/weather.py adds it to Claude Desktop's config, and asking Claude for the weather alerts in CA calls get_alerts. The entry it wrote is in Claude Desktop under Settings, Developer, Edit config, inside an mcpServers object. Cursor takes the same JSON in its MCP settings, which open its mcp.json, and the same question works there.

json
{
    "mcpServers":{
        "weather": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp[cli]",
        "mcp",
        "run",
        "E:\\mcpcourse\\mcpcrashcourse\\server\\weather.py"
      ]
    }
}
}

The entry starts the server with uv run --with mcp[cli] mcp run and an absolute path. mcp install still exists in mcp 2.2 and now pins the mcp version you have installed, so mcp install shop.py works for the shop server too. The rest of this lesson writes the host settings for the shop server by hand.

Claude Code

Example
claude mcp add shop -- python /absolute/path/to/shop.py

Everything after -- is the command Claude Code runs to start the server over stdio, which is why shop.py needs the mcp.run() from the stdio lesson. Use absolute paths, and the Python that has mcp installed, such as /path/to/.venv/bin/python. Inside a session, /mcp shows whether shop connected and lists its tools.

That command starts the server over stdio. The Streamable HTTP lesson changed the end of shop.py to serve over HTTP, so for this command put the ending from the stdio lesson back, mcp.run(). Or keep HTTP, start python shop.py yourself, and add the running server by its URL:

bash
claude mcp add --transport http shop http://127.0.0.1:8200/mcp

Claude Code then connects to the server instead of starting it, so the server has to be running whenever you use it.

Claude Desktop and Cursor

Exampleclaude_desktop_config.json, or .cursor/mcp.json
{
  "mcpServers": {
    "shop": {
      "command": "/absolute/path/to/.venv/bin/python",
      "args": ["/absolute/path/to/shop.py"]
    }
  }
}

Both read an mcpServers object with a command and its arguments, and start the server over stdio, so they also need the mcp.run() ending. Restart the application after editing it. VS Code uses .vscode/mcp.json with the key servers instead, and a type on each entry.

The MCP Inspector

Example
pip install "mcp[cli]==2.2.0"
mcp dev shop.py --with typer

mcp dev opens the MCP Inspector, a web page with a tab for tools, resources and prompts, where you call each one by hand through a form built from its schema. It needs Node.js, because the Inspector is a Node application, and uv, which starts your server; --with typer is explained in MCP Inspector with mcp dev. Use it to check a server before connecting a host to it.

When it does not show up

  • A relative path. Hosts start the server from their own working folder, not yours.
  • The wrong Python. The host's command must use the environment where mcp is installed.
  • Something printing to standard output at start-up, before the SDK takes over. Log to standard error instead.

Starting the server vs connecting to one

Command configURL config
The hostStarts the server over stdioConnects to a running server
Server endingmcp.run()mcp.run(transport="streamable-http", ...)
Must be running firstNo, launched on demandYes

When each config fits

  • The command form when the host should launch the server for you.
  • The URL form when the server is already running and shared.
  • The Inspector when you want to try a server before wiring a host to it.
Watch out
A relative path or the wrong Python is why a host shows no tools. Use an absolute path to the interpreter that has mcp installed.
Try it yourself
  • Add the shop server to Claude Code and ask: "Where is order A17?" Watch which tool it asks to call.
  • Open the Inspector, call lookup_order with Z9, and read the error text the model would see.
  • Run claude mcp list.

Every expert started right here.