MCP servers and clients · Chapter 16 of 16

The interview round

By the end of this chapter you have answered, against the clock, the questions an interviewer asks about MCP: read a wire transcript and find what is wrong, write a server and a client in ten minutes each, make the design calls (tool, resource or prompt; N times M), and review code for security. Build it in your browser: a real editor and terminal, AI that explains, and tests that tell you when it works.

  • Part: Clients and production
  • 5 tasks
  • Python
  • In the all labs plan

The first 2 chapters of MCP servers and clients are free. This one comes with the all labs plan.

Why you need this

Bazaar Bhai is hiring a second engineer, and Simran has asked you to help run the interviews. First, she says, sit them yourself. Each question takes ten minutes and tests one idea from this lab. None of them needs anything you have not done; all of them need it quickly, and without looking it up.

What you build: 5 tasks

Each task has tests. You write the code in the lab's editor and press Check.

  1. Task 1 · interview question

    Interview: wire.py, read the wire

    Time yourself: 10 minutes. transcripts.txt holds five real sessions, A to E, each with one thing wrong. In wire.py, write BUGS, a dict from each letter to what is wrong, one of the labels listed in the starter (not json on stdout, reply to a notification, wrong id, missing envelope, error hidden as success, unknown method, version refused).

  2. Task 2 · interview question

    Interview: ten_minute_server.py, a server in ten minutes

    Time yourself: 10 minutes. In ten_minute_server.py, an MCPServer with one tool, store_hours(store_id), returning store_id, opens and closes from the stores table (a ToolError naming an unknown store); the resource template bazaar://products/{product_id}, JSON with the product's id, name, category, price and mrp (not found, -32602, for an unknown one); and the prompt price_check(product_id), one message naming the product and its price.

  3. Task 3 · interview question

    Interview: ten_minute_client.py, a client in ten minutes

    Time yourself: 10 minutes. In ten_minute_client.py, start desk_server.py over stdio and print five lines: the server's name and the protocol version separated by a space; tools: and the tool names joined by a comma and a space; BB09 P071: <units> units from stock_level; BB09 is in <area> from the resource bazaar://stores/BB09; and the text of the first message of the prompt restock_plan for BB09 over 3 days.

  4. Task 4 · interview question

    Interview: design.py, tool, resource or prompt, and N times M

    Time yourself: 10 minutes. In design.py, write KIND, the six capabilities in the starter as keys, each mapped to tool, resource or prompt. Then write glue(needs), where needs maps each app to the sources it uses, returning (without, with): one piece per app and source used without MCP (a source listed twice by one app counts once), and with MCP one client per app that uses something plus one server per source used.

  5. Task 5 · interview question

    Interview: review.py, a quick security review

    Time yourself: 10 minutes. snippets.py holds seven short pieces of servers and hosts. In review.py, write VERDICTS, a dict from each snippet's number, 1 to 7, to one of the verdicts listed in the starter (sql injection, no scope, secret in code, trusts tool results, leaks internals, unmarked change, fine).

What you will learn

  • Interview: wire.py, read the wire
  • Interview: ten_minute_server.py, a server in ten minutes
  • Interview: ten_minute_client.py, a client in ten minutes
  • Interview: design.py, tool, resource or prompt, and N times M
  • Interview: review.py, a quick security review

More in Clients and production

Build The interview round yourself

Bazaar Bhai, a chain of 40 kirana stores in Jaipur, exposes its stock and orders once, to every AI tool. A real editor and terminal in your browser, AI that explains, and a Check that says when it works.

The first 2 chapters of MCP servers and clients are free. This one comes with the all labs plan.