Skip to content

CCDV-F · Domain 8: Tools and MCP · 10% of the exam

Task 8.2: MCP Server Development and Integration

Building and deploying an MCP server and connecting it to Claude applications and workflows: its resources, tools and prompts, the stdio or HTTP transport, and authentication.

Study it

  • MCP servers: resources, tools, prompts, transports and authentication

    Lesson coming

Sample questions

Try each one before opening the answer. Every option is explained, with the Anthropic documentation page that proves it.

Question 1 · choose 1

You wrote a local MCP server in Python that Claude Code launches with the stdio transport:mcp = FastMCP("inventory") @mcp.tool() def stock_level(sku: str) -> str: print(f"looking up {sku}") return lookup(sku)The server connects, but whenever stock_level runs, Claude Code reports a broken connection or unreadable messages. What should you change?

  1. APrint each debug line as a JSON object so that the client can parse it
  2. BRaise the client's tool timeout so that the lookup has time to finish
  3. CSend the debug output to stderr, for example through the logging module
  4. DKeep the print, which goes to the terminal, and return the result as structured content instead
Show the answer and why
  • APrint each debug line as a JSON object so that the client can parse it

    Incorrect

    Only valid MCP messages may go to stdout; any other JSON still corrupts the stream.

  • BRaise the client's tool timeout so that the lookup has time to finish

    Incorrect

    The messages break because of the print, not because the call takes too long.

  • CSend the debug output to stderr, for example through the logging module

    Correct

    stdout carries the protocol messages; the server may log to stderr.

  • DKeep the print, which goes to the terminal, and return the result as structured content instead

    Incorrect

    print() writes to stdout, which is the server's protocol channel under stdio.

Under stdio, the client reads MCP messages from the server's stdout, and the server must not write anything there that is not a valid MCP message. print() writes to stdout by default, so log to stderr, for example with the logging module.

Question 2 · choose 1

Your MCP server gives Claude read access to customer records. There are about 40,000 customers, and Claude should be able to read any one record when a conversation needs it. You want clients to discover the data without the server announcing 40,000 separate entries. How should the server expose the records?

  1. AAs a resource template with a parameterized URI, such as crm://customers/{customer_id}
  2. BAs 40,000 direct resources, one fixed URI per customer, listed by the server
  3. CAs one prompt per customer that the user selects before each conversation
  4. DAs a single direct resource whose content holds all 40,000 records at once
Show the answer and why
  • AAs a resource template with a parameterized URI, such as crm://customers/{customer_id}

    Correct

    Resource templates are parameterized URIs for flexible queries and are discoverable through resources/templates/list.

  • BAs 40,000 direct resources, one fixed URI per customer, listed by the server

    Incorrect

    That is exactly the per-record listing the design must avoid.

  • CAs one prompt per customer that the user selects before each conversation

    Incorrect

    Prompts are user-controlled instruction templates, not a way to read records on demand.

  • DAs a single direct resource whose content holds all 40,000 records at once

    Incorrect

    One fixed URI would return the whole data set instead of the record a conversation needs.

Resources come as direct resources with fixed URIs or as resource templates, parameterized URIs such as travel://activities/{city}/{category} that serve flexible queries. Templates carry their own metadata and are discoverable, so one template can cover every customer record.

Question 3 · choose 1

Your remote MCP server uses the Streamable HTTP transport of the 2026-07-28 specification and answers a long tools/call request with an SSE response stream. The user cancels the call in the client. How does the client signal the cancellation on this transport?

  1. AIt sends a notifications/cancelled message in a new POST, naming the ID of the request
  2. BIt sends a DELETE request with the Mcp-Session-Id header to end the whole session
  3. CIt closes that request's SSE response stream, which the server treats as cancellation
  4. DIt can't; the server keeps working on the call until it has sent the final response
Show the answer and why
  • AIt sends a notifications/cancelled message in a new POST, naming the ID of the request

    Incorrect

    On Streamable HTTP no notifications/cancelled message is expected; that message is used on stdio.

  • BIt sends a DELETE request with the Mcp-Session-Id header to end the whole session

    Incorrect

    The 2026-07-28 revision removed protocol-level sessions from Streamable HTTP.

  • CIt closes that request's SSE response stream, which the server treats as cancellation

    Correct

    The server must treat closing a request's SSE response stream as cancellation of that request.

  • DIt can't; the server keeps working on the call until it has sent the final response

    Incorrect

    After the stream closes, the server should stop work and must not send further messages for the request.

In the 2026-07-28 Streamable HTTP transport each request has its own response stream, so closing that SSE stream is itself the cancellation signal: the server must treat it as cancellation, should stop work as soon as practical and must not send further messages for the request. The notifications/cancelled message belongs to the stdio transport, which has no per-request stream.

Question 4 · choose 1

You are adding authentication to a local MCP server that Claude Code launches over stdio. A teammate plans to implement the MCP OAuth authorization flow for it. What does the specification say?

  1. AEvery transport must implement the OAuth authorization flow
  2. Bstdio servers must put a bearer token in each JSON-RPC message they send
  3. Cstdio servers authenticate through the client's API key only
  4. Dstdio servers should retrieve credentials from the environment
Show the answer and why
  • AEvery transport must implement the OAuth authorization flow

    Incorrect

    The authorization specification targets HTTP-based transports.

  • Bstdio servers must put a bearer token in each JSON-RPC message they send

    Incorrect

    The specification points stdio servers to credentials from the environment.

  • Cstdio servers authenticate through the client's API key only

    Incorrect

    The specification does not route stdio credentials through the client's key.

  • Dstdio servers should retrieve credentials from the environment

    Correct

    HTTP-based transports should conform; stdio should retrieve credentials from the environment.

Implementations using an HTTP-based transport should conform to the MCP authorization specification. Implementations using stdio should not follow it and should instead retrieve credentials from the environment.

Practice domain 8 →Practice all domains →