Lab1 tasks
MCP Fundementals Tasks - Lab 1
Welcome to the MCP Lab Tasks section!
This comprehensive collection of hands-on exercises will help you master the Model Context Protocol through practical implementation.
Each lab has 15 exercises designed to build your skills progressively. Try to solve each exercise on your own before clicking the solution dropdown.
Exercise 1.1: Identify MCP Components
Identify the three main components of the MCP architecture and explain their roles.
Solution
The three main components are:
- MCP Client: Applications that host LLMs (like Roo Code, Claude Desktop)
- MCP Server: Exposes capabilities to clients (tools, resources, prompts)
- MCP Protocol: JSON-RPC 2.0 based communication standard
Exercise 1.2: MCP vs Traditional APIs
Explain how MCP differs from traditional REST APIs in terms of LLM integration.
Solution
MCP provides a standardized protocol specifically designed for LLM integration, while traditional APIs require custom integration code for each application. MCP enables universal connectivity across all MCP-compatible clients.
Exercise 1.3: Transport Layers
List the three main transport mechanisms supported by MCP and their use cases.
Solution
- STDIO: Most common, for local subprocess communication
- SSE (Server-Sent Events): HTTP-based for remote servers
- Streamable HTTP: Modern standard for remote MCP servers
Exercise 1.4: MCP Capabilities
Name the three types of capabilities MCP servers can expose.
Solution
- Tools: Functions for performing actions
- Resources: Contextual data for reading
- Prompts: Pre-built prompt templates
Exercise 1.5: JSON-RPC Message Types
Identify the three types of messages used in MCP communication.
Solution
- Requests: Require responses (tools/list, resources/read)
- Responses: Match to requests with results or errors
- Notifications: One-way messages (initialized, cancelled)
Exercise 1.6: MCP Initialization Flow
Describe the sequence of messages during MCP server initialization.
Solution
- Client sends
initializerequest - Server processes and responds with
initializeresponse - Client sends
initializednotification - Connection is established
Exercise 1.7: Tool Definition Schema
What information must be included when defining an MCP tool?
Solution
- Tool name
- Description
- Input parameters (JSON Schema)
- Whether it has side effects
Exercise 1.8: Resource Identifiers
How are MCP resources identified and what types of data can they contain?
Solution
Resources are identified by URIs and can contain text, binary data, or structured data. They are typically read-only.
Exercise 1.9: Prompt Templates
Explain the purpose of MCP prompts and how they differ from regular prompts.
Solution
MCP prompts are pre-built, reusable prompt templates that can include embedded resources and support arguments for customization, ensuring consistency across applications.
Exercise 1.10: Security Considerations
List three security best practices for MCP implementations.
Solution
- Authentication & Authorization: Validate requests and use least-privilege access
- Data Privacy: Control what data is exposed
- Input Validation: Sanitize user inputs to prevent injection attacks
Exercise 1.11: MCP Client Examples
Name three popular MCP client applications.
Solution
- Roo Code (VS Code extension)
- Claude Desktop
- Continue.dev
Exercise 1.12: Protocol Versioning
How does MCP handle protocol versioning and backward compatibility?
Solution
MCP uses capability negotiation during initialization, allowing clients and servers to agree on supported features and maintain backward compatibility.
Exercise 1.13: Error Handling
How are errors communicated in MCP?
Solution
Errors are communicated through JSON-RPC error responses with error codes, messages, and optional data fields.
Exercise 1.14: Connection Lifecycle
Describe the complete MCP connection lifecycle from start to finish.
Solution
- Initialization handshake
- Capability discovery
- Normal operation (tool calls, resource access)
- Cleanup and graceful shutdown
Exercise 1.15: MCP Ecosystem Benefits
Explain three key benefits of the MCP ecosystem approach.
Solution
- Universal Integration: One server works with all MCP clients
- Standardized Communication: Consistent interface across applications
- Rapid Development: Reduced integration time and duplication