AI Agents and Workflows

6 lessons

Module Progress...
AI Agents and Workflows

Build an MCP Agent

Build an MCP server that exposes portfolio data through resources, tools, and prompts. Connect an agent that discovers capabilities at runtime and manage the portfolio through the protocol.

Agents can reason and plan1, but without structured access to live data they mostly talk about work instead of doing it. You can hard-wire database queries into an agent, but that breaks down the moment you want to swap the backend, or add a new capability. The Model Context Protocol (MCP)2 fixes this with a shared interface built around three primitives: resources, tools, and prompts.

We'll build a portfolio management system that uses all three. The MCP server sits on top of SQLite and exposes five stock holdings, a cash balance, and a transaction log. A LangGraph agent connects over stdio, discovers what the server can do at runtime, and manages a ~$258k portfolio entirely through the protocol.

Tutorial Goals

  • Understand MCP's three primitives - resources, tools, and prompts
  • Build an MCP server with FastMCP backed by SQLite
  • Connect a LangGraph agent to the server via stdio transport
  • Load MCP Resources as agent context and discover tools at runtime
  • Run multi-turn conversations where the agent executes real trades

What is MCP?

Footnotes

  1. Toolformer: Language Models Can Teach Themselves to Use Tools (Schick et al., 2023)

  2. Model Context Protocol

  3. SQLite Write-Ahead Logging

  4. Average Cost Basis Method (Investopedia)

  5. langchain-mcp-adapters

  6. Gorilla: Large Language Model Connected with Massive APIs (Patil et al., 2023)