Exercise: Environment Setup

ch02-00-environment-setup
⭐ beginner ⏱️ 15 min

Before building your first MCP server, let's ensure your development environment is properly configured. This setup exercise will verify all required tools are installed and working.

🎯 Learning Objectives

💡 Hints

Hint 1: Installing Rust

If Rust is not installed, run:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/env

Verify with rustc --version - should be 1.82.0 or later.

Hint 2: Installing cargo-pmcp

Install the PMCP development toolkit:

cargo install cargo-pmcp

If installation fails, first update Rust: rustup update stable

Hint 3: MCP Inspector

The MCP Inspector is a web-based tool for testing MCP servers:

npx @modelcontextprotocol/inspector

No installation needed - it runs via npx.

Hint 4: Setting up Claude Desktop

Download Claude Desktop from claude.ai.

Configure MCP servers in ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows).

⚠️ Try the exercise first! Show Solution
# Complete verification script
echo "=== Rust Toolchain ==="
rustc --version && cargo --version

echo -e "\n=== cargo-pmcp ===" cargo pmcp --version

echo -e "\n=== Node.js (for MCP Inspector) ===" node --version && npx --version

echo -e "\n=== Environment Ready! ==="

Explanation

Expected output:

🧪 Tests

View Test Code
# Test 1: Rust is installed
rustc --version | grep -q "rustc 1\." && echo "PASS: Rust installed" || echo "FAIL: Rust not found"

Test 2: Cargo is available

cargo --version | grep -q "cargo 1." && echo "PASS: Cargo installed" || echo "FAIL: Cargo not found"

Test 3: cargo-pmcp is installed

cargo pmcp --version 2>/dev/null && echo "PASS: cargo-pmcp installed" || echo "FAIL: cargo-pmcp not found - run: cargo install cargo-pmcp"

Test 4: Node.js is available (for MCP Inspector)

node --version | grep -q "v" && echo "PASS: Node.js installed" || echo "WARN: Node.js not found - needed for MCP Inspector"

🤔 Reflection

  • Did you encounter any installation issues? Note them for troubleshooting.
  • Which MCP client will you use? (Claude Desktop, Cursor, VS Code + Continue)
  • Are you planning to deploy to cloud? If so, ensure you have the relevant CLI installed (aws, wrangler, or gcloud).