A4 · MODEL CONTEXT PROTOCOL

Run one tool, one resource and one client.

Build a small read-only MCP integration, inspect its advertised capabilities, then call it through a client. ابنِ تكاملاً صغيراً للقراءة فقط وافحص قدراته ثم استدعِه عبر عميل.

AI for Palestine practice template—not an official Anthropic resource.
قالب تدريبي من AI for Palestine وليس مورداً رسمياً من Anthropic.

01

Install, inspect, then connect.

  1. 01

    Create an isolated project

    Run uv init mcp-practice, enter the directory, then install the CLI with uv add "mcp[cli]".

  2. 02

    Save both Python files

    Keep them in the same directory. The server exposes a typed tool and a templated resource without secrets or write operations.

  3. 03

    Inspect the server first

    Run uv run mcp dev mcp_server_starter.py. Inspect schemas and test valid, unknown and boundary inputs.

  4. 04

    Run the client

    Run uv run python mcp_client_starter.py. Confirm discovery lists match_course before the client calls it.

02

Download the working starters.

mcp_server_starter.py

Download server ↓
from mcp.server import MCPServer

mcp = MCPServer("AI for Palestine Practice")

@mcp.tool()
def match_course(topic: str) -> str:
    """Suggest one advanced course."""
    ...

@mcp.resource("guide://courses/{course_id}")
def course_guide(course_id: str) -> str:
    ...

mcp_client_starter.py

Download client ↓
from mcp import Client
from mcp_server_starter import mcp

async with Client(mcp) as client:
    tools = await client.list_tools()
    result = await client.call_tool(
        "match_course", {"topic": "MCP server"}
    )
03

Connect course concepts to the current SDK.

Discovery

The client lists advertised tools before selecting one.

Primitive

match_course is a model-callable tool; the parameterized guide URI is a templated resource.

Inspector

Test the server surface before connecting a full AI application.

Version note

The official course may teach lower-level Client Session messages. This starter uses the current stable SDK v2 high-level Client.