Client Logging with FastMCP
Why MCP Has Its Own Logging
If you have written Python before, you are probably familiar with the standard logging module. You create a logger, call logger.info("something happened"), and the message ends up in a file or on the console. That kind of logging is designed for the server operator — the person running the Python process. It writes to wherever the server's log output is configured to go. The MCP client never sees those messages.
MCP client logging is a different thing entirely. When your tool calls await ctx.info("Analyzing 42 dog breeds"), that message travels over the MCP protocol to the client application — Claude Desktop, a custom IDE integration, or whatever program connected to your server.
@mcp.tool
async def any_tool(ctx: Context) -> Dict[str, Any]:
awaitPractical MCP with FastMCP & LangChain
Engineering the Agentic ExperienceEnroll now to unlock current content and receive all future updates for free. Your purchase supports the author and fuels the creation of more exciting content. Act fast, as the price will rise as the course nears completion!
