Mastra MCP tutorial: connect tools to ChatGPT
Learn how Mastra exposes application tools through MCP, with a ChatGPT returns-desk demo, OAuth login, and guidance on stateless requests.
Player not loading? Watch on YouTube
This Mastra workshop explains how to expose an application's capabilities through MCP so users can access them through an AI agent they already use. The speakers compare that approach with building an embedded assistant, which also requires work on memory, behavior and evaluations.
The demonstration connects a returns-desk MCP server to ChatGPT through developer mode. OAuth handles account authentication, and a public tunnel makes the server on the presenter's machine reachable by ChatGPT. The example checks order eligibility and requests a return, including a shipping label. It also shows a confirmation step through elicitation. This is a networked development setup, rather than an offline model demonstration.
The code walkthrough covers Mastra's TypeScript server configuration, resources, prompt hints and tool schemas. A return-processing tool calls a workflow internally, while Mastra Studio provides traces and performance metrics.
The speakers describe a newer specification direction involving stateless requests, server discovery and multi-round input requests. They explicitly note that Mastra had not yet adopted the latest specification, so those explanations differ from the demonstrated implementation. Their practical advice includes reusing business logic, enforcing required approvals within tools, making mutations safe to retry and testing schemas with the clients users actually use.