Loading video player...
I was pasting raw JSONL logs into Claude asking "what's wrong with this bot?" ā and getting useless hedged answers. That's not a Claude problem. That's a context engineering failure. Here's how I fixed it with a 40-line Python MCP server. I build fleet_mcp.py from scratch using FastMCP ā a thin wrapper that exposes 4 tools giving Claude structured, query-able access to my 28-bot trading fleet logs stored in SQLite. Same question. Completely different answer. š§ WHAT I BUILD fleet_mcp.py ā 4 MCP tools wrapping an existing fleet analyzer: ⢠fleet_performance(date) ā fleet-wide P&L, win rate, active bots ⢠bot_errors(bot_id, date) ā specific bot error events and counts ⢠fleet_incidents(date) ā events hitting 3+ bots in a 5-min window (provider outages) ⢠bot_validate(bot_id, date) ā compare JSONL logs vs Alpaca broker fills š CONTEXT ENGINEERING RESEARCH This video is grounded in current research on how AI agents fail when given the wrong context: ā Effective Context Engineering for AI Agents (Anthropic) https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents ā How Contexts Fail and How to Fix Them ā introduces context poisoning (dbreunig) https://www.dbreunig.com/2025/06/22/how-contexts-fail-and-how-to-fix-them.html ā Context Engineering for Agents (LangChain) https://blog.langchain.com/context-engineering-for-agents/ ā±ļø CHAPTERS 0:00 MCP Servers and Context Engineering 1:06 Context Poisoning and Slash Commands 3:18 What is MCP? The USB-C for AI 5:24 Context Engineering Basics 6:25 Context Poisoning Explained 7:41 The Fleet Log Problem 9:52 Designing a Standardized Log Schema 12:10 FastMCP for MCP Server Creation 13:27 orjson for Fast JSON Processing 14:35 Preparing Conda Environment 16:48 Setting Up FastMCP for Fleet Analysis 18:54 Creating Fleet with FastMCP 20:01 MCP Server Tools for Error Analysis 22:14 Updating JSON Settings for MCP Server 23:23 Reviewing Fleet Analyzer Tools 24:25 Testing Fleet Performance MCP Tools 27:37 Fleet MCP Live Data Integration 28:39 Analyzing Fleet Status and Errors š Full Claude Code Series: https://www.youtube.com/playlist?list=PL6k8P_6WP-AAwPxvtgwUza8QQHfc1I5tU š Subscribe for Python algo trading automation builds ā ļø DISCLAIMER: Educational content ONLY. NOT financial advice. I am NOT a financial advisor. Trading involves substantial risk. You are solely responsible for your own financial decisions and any losses incurred.