Lab Guide — MCP Concepts & Protocol
Three exercises exploring MCP client connections, tool calls, and the server ecosystem.
Setup: Open
lab.pdf in Jupyter. Install the MCP Python SDK: pip install mcp. The notebook uses a mock MCP server for Exercises 1–2, so no external server is required.
📥 Demo Files
⬇ claude_desktop_config.jsonExercise 1 — MCP Client: Connect & List Tools
EX 1
Connect to an MCP server and discover its capabilities
Using the MCP Python SDK, create a client session that connects to a server process and lists its available tools.
- Create an MCP
ClientSessionconnected via stdio transport - Call
initialize()to perform the capability handshake - Call
list_tools()and print each tool’s name, description, and input schema
# Expected output format:
# Tool: read_file
# Description: Read the contents of a file
# Parameters: {"path": {"type": "string"}}
# Tool: list_directory
# Description: List files in a directory
# Parameters: {"path": {"type": "string"}}
Checkpoint: You can list all tools from the connected server with their schemas.
Exercise 2 — Call a Tool via MCP
EX 2
Execute a tool call through the MCP protocol
Use the client session to call a tool and process the result.
- Call a tool using
session.call_tool(name, arguments) - Parse the response content
- Handle errors (invalid tool name, missing parameters)
# Call a tool
result = await session.call_tool("read_file", {"path": "/tmp/test.txt"})
print(result.content[0].text)
Checkpoint: You can call a tool, receive its result, and handle error cases.
Exercise 3 — MCP Server Survey
EX 3
Research 5 popular MCP servers
Survey the MCP ecosystem and document 5 servers. For each, record:
- Server name and source (official vs community)
- What tools it exposes
- What resources it provides (if any)
- Transport type (stdio / SSE)
- A practical use case for the server
Compile your findings into a comparison table in the notebook.
Checkpoint: A completed table with 5 servers, their capabilities, and use cases.
Tip: Start your survey at github.com/modelcontextprotocol/servers. The README lists official and community servers with descriptions.