from mcp.server import MCPServer


server = MCPServer("Read-only catalog fixture", version="1.0.0")
BOOK_ID = "mcp-001"
BOOK_TITLE = "Local Protocol Notes"
BOOK_URI = "catalog://books/mcp-001"


@server.tool()
def lookup_book(book_id: str) -> str:
    """Look up a book in the static teaching catalog by ID."""
    if book_id == BOOK_ID:
        return BOOK_TITLE
    return "No matching book."


@server.resource(BOOK_URI, name="book_record", mime_type="text/plain")
def read_book_record() -> str:
    return f"{BOOK_ID}: {BOOK_TITLE}"


@server.prompt()
def book_citation() -> str:
    """Return a short citation template instruction."""
    return "Cite the supplied catalog record by book ID and title."


if __name__ == "__main__":
    server.run(transport="stdio")
