Practical Usage of
AI Agents and MCP Protocol

From Theory to Working Code in 30 Minutes

Muhammad Abdugafarov
October 11, 2025
Khujand, Tajikistan

Slides QR Code

Scan to view slides

About Me 👨‍💻

Muhammad Abdugafarov

Name: Muhammad Abdugafarov

Role: Team Lead at SilkRoad Professionals

Experience: 8 years in IT

Interests: AI, product development

What is an LLM? 🧠

Large Language Model

💡 LLM = "Brain" that understands human language

What Can LLMs Do? ✨

Can:

  • Understand text, images, audio
  • Generate responses
  • Analyze data
  • Write code
  • Translate languages

Cannot:

  • Perform real-world actions
  • Use external tools
  • Change system state
  • Work with real-time data

💡 LLMs can think, but can't act

From LLM to AI Agent 🤖

LLM (Just a model)
    ↓
    + Tools
    + Memory
    + Decision-making ability
    ↓
AI Agent (Can act)

AI Agent = LLM + ability to interact with the world

What is an AI Agent? 🤖

Components:

  • 🧠 LLM (brain)
  • 🛠️ Tools (hands)
  • 💾 Memory (context)
  • 🎯 Goal (task)

Capabilities:

  • Performs actions
  • Makes decisions
  • Uses tools
  • Solves complex tasks

Agent = Not just a chatbot, but an assistant that can act!

The Problem 🤔

LLMs are inherently limited

Question: How to give LLMs the ability to use tools?

Solution: MCP ✨

Model Context Protocol

MCP = USB for AI tools

What is MCP? 🔌

System Architecture 🏗️

System Architecture

Why MCP? 💡

With MCP ✓

  • Standardized protocol
  • Plug-and-play tools
  • Works with any LLM
  • Easily extensible

Without MCP ✗

  • Custom integration
  • For each tool
  • Tightly coupled to LLM
  • Hard to maintain

Today's Demo 🎬

Expense Tracker Agent

System Architecture 🔧

User → AI Agent (Agno) → MCP Server → FastAPI → SQLite
                ↓
          OpenAI GPT-4
                ↓
        Processes request
        Selects tools
        Formats response

Tech Stack 🛠️

MCP Server - code 💻

from fastapi import FastAPI
from fastapi_mcp import FastApiMCP

app = FastAPI()

# That's it! 5 lines of code
mcp = FastApiMCP(
    app,
    name="Expense Tracker MCP"
)

# Automatically converts all FastAPI routes into MCP tools!

FastAPI Backend 🚀

@app.post("/transactions")
async def create_transaction(
    data: TransactionCreate
):
    return store.create(data)

# Regular FastAPI route
# Becomes MCP tool automatically
# AI can call it via MCP

Agent Configuration ⚙️

agent = Agent(
    name="Expense Tracker Agent",
    model=OpenAIChat(id="gpt-4"),
    
    # Connect to MCP server
    tools=[MCPTools(
        url="http://localhost:9002/mcp"
    )],
    
    # System instructions
    instructions=SYSTEM_PROMPT
)

🎬

LIVE DEMO

Let's see how it works!

Under the Hood 🔍

1. User: "Show my balance"
   ↓
2. GPT-4 thinks:
   - Need tool: get_summary
   ↓
3. MCP call:
   POST /mcp/tools/get_summary
   ↓
4. FastAPI executes:
   SELECT SUM(...) FROM transactions
   ↓
5. Agent responds:
   "Your balance: 5000.00"

Real-World Use Cases 🌍

Production Benefits 📈

Try It Yourself! 🚀

# Clone the repository
git clone https://github.com/dev-muhammad/MCPAgent
cd MCPAgent

# Configure
cp .env.example .env
# Add OPENAI_API_KEY to .env

# Run
cd server && python start.py --mcp
cd server && python start.py --api
cd agent && python agent.py

Resources 📚

Documentation:

  • MCP: modelcontextprotocol.io
  • FastAPI-MCP: github.com/jlowin/fastapi-mcp
  • Agno: docs.agno.com

GitHub Repository:

Questions? 🤔

Thank you for your attention! 🎉

1 / 24

Keyboard Shortcuts ⌨️