FastMCP and LangGraph: build and test an MCP agent
Learn to build Python MCP tools, test them directly, and connect a LangGraph agent. The demo uses STDIO plus OpenAI and Tavily API keys.
Player not loading? Watch on YouTube
Rabia Shahab builds a Python FastMCP server and connects its tools to a LangGraph AI agent. The presenter explains how decorators, type hints and docstrings define callable tools and generate their schemas. The examples cover web search, page fetching, calculation and saving or reading text notes.
The walkthrough tests the tools directly before introducing the model. That distinction matters in the calculator demo: the standalone function expects a mathematical expression, while the agent converts a natural-language question into a tool call. Later examples combine search and page retrieval with saving a summary to summary.txt, then reading saved content back.
The demonstrated setup runs the server as a local subprocess over STDIO, with LangChain MCP adapters handling communication. It requires the repository's Python dependencies and OpenAI and Tavily API keys. Although the tools execute on the presenter's computer, the demonstrated model and search use external APIs; this is not an offline model setup.
Implementation details include a 15-second page-fetch timeout and a 3,000-character fetched-text limit. The presenter recommends one task per tool and distinct, precise docstrings. Closing questions touch on connecting a local LLM and using streamable HTTP, but do not demonstrate that configuration.