"""AI for Palestine practice MCP server (Python SDK v2)."""

from mcp.server import MCPServer

mcp = MCPServer("AI for Palestine Practice")

COURSE_GUIDES = {
    "a1": "Claude Code in Action: goals, hooks, skills and verification.",
    "a2": "Agent Skills: lean SKILL.md with supporting references.",
    "a3": "Subagents: bounded independent work with evidence.",
    "a4": "MCP: reusable tools, resources and prompts.",
}


@mcp.tool()
def match_course(topic: str) -> str:
    """Suggest one advanced course from a short learning topic."""
    words = topic.lower()
    if "mcp" in words or "protocol" in words:
        return "A4"
    if "subagent" in words or "delegate" in words:
        return "A3"
    if "skill" in words or "workflow" in words:
        return "A2"
    return "A1"


@mcp.resource("guide://courses/{course_id}")
def course_guide(course_id: str) -> str:
    """Read a short guide for A1, A2, A3 or A4."""
    key = course_id.lower()
    return COURSE_GUIDES.get(key, "Unknown course. Choose A1, A2, A3 or A4.")
