Course 6 of 6
MCP Advanced Topics
Sampling, notifications, file system access, transport mechanisms, authentication patterns, and production MCP server architecture.
🚀Transport Layers: stdio vs SSE
Choosing the wrong transport is a common exam mistake. The rule is simple: local = stdio, remote = SSE.
| Transport | Use case | Network | Streaming |
| stdio | Local subprocess (same machine) | No — IPC only | Not applicable |
| SSE (HTTP) | Remote/cloud servers | Yes — crosses network boundaries | Real-time via HTTP |
Exam rule: If the scenario mentions cloud deployment, distributed system, or network boundary → SSE is always correct. WebSocket is NOT a supported MCP transport.
📡Sampling
Sampling allows an MCP server to request LLM completions from the client (reverse direction). This enables servers to be "AI-aware" — they can ask the model to process data before returning a result.
- The server sends a
sampling/createMessage request to the client
- The client (which holds the API key) performs the LLM call and returns the result
- Servers never need their own API keys — the client mediates all model access
- Use for: summarizing content, classifying data, generating text within a tool response
🔔Notifications & Progress
Long-running MCP tools can send progress notifications to the client so users aren't left waiting with no feedback.
- Server sends
notifications/progress messages during execution
- Client displays progress to the user in real time
- Also used for:
resources/updated (cached resource invalidation), tools/list_changed (dynamic tool registration)
- Notifications are fire-and-forget — they don't require a response from the client
📁File System Access & Resources as Content Catalogs
MCP resources are ideal for exposing file systems, databases, or any read-only data catalog. Resources with high-quality descriptions enable Claude to intelligently select which content to retrieve.
- Static resources: fixed URI, fixed content (e.g.,
file:///config.json)
- Templated resources: parameterized URI (e.g.,
db://users/{id})
- Resource descriptions function as a catalog — Claude reads them to decide what to fetch
- Write detailed, accurate descriptions; vague descriptions cause Claude to miss or misuse resources
- Resources surface via
list_resources(); content via read_resource(uri)
🔒Authentication & Production Patterns
MCP servers in production need proper auth. The exam tests patterns for secure deployment.
Environment variablesPass credentials via env vars in server config — never hardcode in tool definitions. Use ${VAR_NAME} expansion in MCP config files.
OAuth / token flowFor SSE servers, use standard HTTP auth headers. The MCP spec supports OAuth 2.0 bearer tokens for remote servers.
Scope limitingEach MCP server should expose only the tools necessary for its purpose. Avoid registering unnecessary tools — they pollute Claude's decision space.
isError flagReturn isError: true in tool results for failures. Claude recognizes this and handles it appropriately without confusing errors with valid empty results.
✍Writing Tool Descriptions That Work
Tool descriptions are the primary mechanism by which Claude decides which tool to call. Poor descriptions are the #1 cause of tool misrouting.
- Start with a verb: "Searches for…", "Returns…", "Creates…", "Deletes…"
- Distinguish similar tools explicitly: "Use this for X, not Y. For Y use get_user_profile."
- Describe what the tool does NOT do when there's risk of confusion
- Include expected input format and what the return value looks like
- Test: send Claude a task and verify it picks the right tool — iterate on descriptions if it doesn't
Exam pattern: Questions often present a broken or suboptimal tool schema and ask you to identify the flaw. Look for: missing descriptions, ambiguous names, overlapping tool scopes, missing nullable fields in JSON Schema.
⚙Multi-Server Configuration in Claude Code
- Configure multiple MCP servers in
.claude/settings.json or settings.local.json
- Each server listed under
mcpServers with its command or URL + env vars
- Project-level settings apply to all contributors; local settings are machine-specific (not committed)
- Tools from all servers are available simultaneously; Claude must distinguish them by name and description
- Use namespacing in tool names if servers overlap:
filesystem_read vs database_read