{ "cells": [ { "cell_type": "raw", "metadata": { "vscode": { "languageId": "raw" } }, "source": [ "# ๐Ÿ› ๏ธ Environment Setup for MCP Development\n", "\n", "Welcome to your MCP development environment setup! This notebook will guide you through installing all the necessary tools and dependencies to start building MCP servers and clients.\n", "\n", "## ๐ŸŽฏ Learning Objectives\n", "\n", "By the end of this notebook, you will have:\n", "- A fully configured Python environment for MCP development\n", "- All necessary dependencies installed\n", "- Your first MCP development workspace ready\n", "- Understanding of the MCP development workflow\n", "\n", "## ๐Ÿ“‹ Prerequisites\n", "\n", "- Python 3.8 or higher installed\n", "- Basic command line knowledge\n", "- Text editor or IDE (VS Code recommended)\n", "\n", "## ๐Ÿ“š Table of Contents\n", "\n", "1. [Python Environment Setup](#python-environment)\n", "2. [Installing MCP Dependencies](#mcp-dependencies)\n", "3. [Development Tools](#development-tools)\n", "4. [Verifying Installation](#verification)\n", "5. [Your First MCP Workspace](#workspace)\n", "6. [Next Steps](#next-steps)\n", "\n", "---\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Let's start by checking your current Python environment\n", "import sys\n", "import platform\n", "import subprocess\n", "\n", "print(\"๐Ÿ Python Environment Check\")\n", "print(\"=\" * 40)\n", "print(f\"Python Version: {sys.version}\")\n", "print(f\"Platform: {platform.platform()}\")\n", "print(f\"Architecture: {platform.architecture()[0]}\")\n", "print(f\"Python Executable: {sys.executable}\")\n", "print()\n", "\n", "# Check if we're in a virtual environment\n", "in_venv = hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix)\n", "print(f\"Virtual Environment: {'โœ… Active' if in_venv else 'โŒ Not active'}\")\n", "\n", "if not in_venv:\n", " print(\"โš ๏ธ RECOMMENDATION: Use a virtual environment for MCP development!\")\n", " print(\" This keeps your MCP dependencies separate from your system Python.\")\n", "\n", "print()\n", "print(\"๐Ÿ“ฆ Checking for pip...\")\n", "try:\n", " import pip\n", " print(f\"โœ… pip version: {pip.__version__}\")\n", "except ImportError:\n", " print(\"โŒ pip not found - please install pip first!\")\n", "\n", "# Check Python version compatibility\n", "major, minor = sys.version_info[:2]\n", "if major >= 3 and minor >= 8:\n", " print(f\"โœ… Python {major}.{minor} is compatible with MCP\")\n", "else:\n", " print(f\"โŒ Python {major}.{minor} is too old - MCP requires Python 3.8+\")\n", " print(\" Please upgrade your Python installation.\")\n" ] }, { "cell_type": "raw", "metadata": { "vscode": { "languageId": "raw" } }, "source": [ "## ๐Ÿ  Setting Up Your Virtual Environment\n", "\n", "A **virtual environment** is essential for MCP development. It isolates your project dependencies and prevents conflicts with other Python projects.\n", "\n", "### Creating a Virtual Environment\n", "\n", "If you don't have a virtual environment active, here's how to create one:\n", "\n", "```bash\n", "# Create a new virtual environment\n", "python -m venv mcp_dev_env\n", "\n", "# Activate it (Linux/Mac)\n", "source mcp_dev_env/bin/activate\n", "\n", "# Activate it (Windows)\n", "mcp_dev_env\\Scripts\\activate\n", "\n", "# Your prompt should now show (mcp_dev_env)\n", "```\n", "\n", "### Why Use Virtual Environments?\n", "\n", "- **๐Ÿ”’ Isolation**: Keep MCP dependencies separate from system Python\n", "- **๐Ÿงน Clean**: Easy to delete and recreate if something goes wrong \n", "- **๐Ÿ“ฆ Reproducible**: Same dependencies across different machines\n", "- **๐Ÿš€ Professional**: Industry standard practice for Python development\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Let's install the core MCP dependencies\n", "# NOTE: In a real environment, you'd run these commands in your terminal\n", "\n", "install_commands = [\n", " \"pip install --upgrade pip\",\n", " \"pip install mcp>=1.0.0\",\n", " \"pip install uvicorn>=0.24.0\", \n", " \"pip install fastapi>=0.104.0\",\n", " \"pip install pydantic>=2.5.0\",\n", " \"pip install httpx>=0.25.0\"\n", "]\n", "\n", "print(\"๐Ÿ“ฆ Core MCP Dependencies Installation\")\n", "print(\"=\" * 50)\n", "print()\n", "print(\"Run these commands in your terminal (with virtual environment active):\")\n", "print()\n", "\n", "for i, cmd in enumerate(install_commands, 1):\n", " print(f\"{i}. {cmd}\")\n", "\n", "print()\n", "print(\"๐Ÿ’ก Pro tip: You can also install all at once:\")\n", "print(\" pip install mcp uvicorn fastapi pydantic httpx\")\n", "print()\n", "\n", "# Let's try to import MCP to see if it's available\n", "print(\"๐Ÿ” Checking if MCP is already installed...\")\n", "try:\n", " import mcp\n", " print(f\"โœ… MCP is installed! Version: {mcp.__version__ if hasattr(mcp, '__version__') else 'Unknown'}\")\n", "except ImportError:\n", " print(\"โŒ MCP not found - you'll need to install it following the commands above\")\n", " \n", "try:\n", " import fastapi\n", " print(f\"โœ… FastAPI is available! Version: {fastapi.__version__}\")\n", "except ImportError:\n", " print(\"โŒ FastAPI not found - needed for HTTP-based MCP servers\")\n", "\n", "try:\n", " import uvicorn\n", " print(\"โœ… Uvicorn is available! (ASGI server for running MCP servers)\")\n", "except ImportError:\n", " print(\"โŒ Uvicorn not found - needed for running MCP servers\")\n" ] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 2 }