Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

15. Model Context Protocol (MCP) Deep Dive

MCP architecture, connection types, and production patterns.

Blog Post: https://arjunprabhulal.com/adk-mcp-deep-dive/

Table of Contents

  1. What is MCP?
  2. Prerequisites
  3. Setup Steps
  4. Connection Types
  5. Running the Agent
  6. Next Steps

What is MCP?

Model Context Protocol is a standardized way for AI agents to connect to external services and data sources. Key benefits:

  • Standardized interface - One protocol for many services
  • Dynamic tool discovery - Agents learn available tools at runtime
  • Secure connections - Built-in authentication support

Prerequisites

  • Python 3.10+
  • Gemini API key from AI Studio
  • GitHub Personal Access Token
  • Node.js (for Firecrawl MCP - optional)

Setup Steps

  1. Navigate to this module:
cd 15-mcp-deep-dive
  1. Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. Install dependencies:
pip install -r ../requirements.txt
  1. Set up environment variables in mcp_agent/.env:
GOOGLE_API_KEY=your-api-key-here
GITHUB_TOKEN=your-github-token
FIRECRAWL_API_KEY=your-firecrawl-api-key  # Optional

Connection Types

Type Class Use Case
HTTP StreamableHTTPServerParams Cloud-hosted MCP servers (GitHub Copilot MCP)
Stdio StdioConnectionParams Local process-based servers (npx tools)

HTTP Connection Example

StreamableHTTPServerParams(
    url="https://api.githubcopilot.com/mcp/",
    headers={"Authorization": f"Bearer {token}"},
)

Stdio Connection Example

StdioConnectionParams(
    server_params=StdioServerParameters(
        command="npx",
        args=["-y", "firecrawl-mcp"],
    ),
)

Running the Agent

Using Programmatic Runner

cd mcp_agent
python agent.py

Test Queries:

  • "Explain MCP and its use in ADK"
  • "Find ADK repositories on GitHub"

Next Steps

Continue to 16. Session, State & Memory