MCPMCP Python SDK 2.2 · Python 3.10+
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
24 small wins to finish your pathNext lesson

Connecting a real host: Claude Code, Claude Desktop and Cursor

A server is only useful inside real applications. Claude Code, Claude Desktop and Cursor all run the same launch command from different config files.

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

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 lesson 15. 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.

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. 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

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 installed, because the Inspector is a Node application. 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.
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.

Slow is fine. Stopping is the only problem.