Your coding agent can already write Mastra code. Now it can help operate Mastra projects too.
The upgraded Mastra CLI gives coding agents a direct way to invoke agents, run workflows, execute tools, inspect memory, run evals, query traces and logs, manage environments, and deploy updates.
This release expands Mastra's coding-agent tooling alongside Mastra skills and the MCP docs server.
Together, your coding agent can drive the full Mastra workflow without checking in. For example:
- Test an agent with different prompts, review the results, and suggest improvements
- Pull recent traces, find patterns, and turn interesting cases into a new dataset
- Inspect logs and traces after a change, then deploy a fix
Get started
Install the CLI:
npm install mastra@latest -gRequires mastra@1.9.0 or later, added in PR #16128.
Runtime
Runtime commands hit a running Mastra server via --url and can be used to invoke agents, run workflows, execute tools, or list and inspect MCP servers.
mastra api --url http://localhost:4111 agent run weather-agent '{"messages":"What is the weather in London?"}'
mastra api --url http://localhost:4111 workflow run start weather-workflow '{"inputData":{"city":"London"}}'
mastra api --url http://localhost:4111 tool execute get-weather '{"location":"London"}'
mastra api --url http://localhost:4111 mcp listFor production, swap --url to a deployed URL, for example: https://acme.com/api.
Memory
Memory commands can be used to create memory threads, search long-term memory, and read working memory.
mastra api thread create '{"agentId":"weather-agent","resourceId":"user_123","title":"Support conversation"}'
mastra api memory search '{"agentId":"weather-agent","resourceId":"user_123","searchQuery":"London weather","limit":10}'
mastra api memory current get '{"threadId":"thread_abc123","agentId":"weather-agent"}'Evals
Eval commands are used to create datasets, run experiments, and read results to verify changes.
mastra api dataset create '{"name":"weather-eval"}'
mastra api experiment run <dataset-id> '{"name":"baseline"}'
mastra api experiment results <dataset-id> <experiment-id>Observability
Observability commands query traces, logs, scores, and metrics across your platform projects using MASTRA_PLATFORM_ACCESS_TOKEN and MASTRA_PROJECT_ID from .env.
mastra api trace list
mastra api log list
mastra api score list
mastra api metric aggregate '{"name":["mastra_model_total_output_tokens"],"aggregation":"sum"}'See observability on Mastra platform for setup instructions.
Platform
Platform commands ship a project, manage environment variables, control the running instance, and diagnose failed deploys.
mastra studio deploy --yes
mastra server env pull > .env.production
mastra server restart
mastra studio deploy suggestions <deploy-id>Project
Project commands lint and validate code before shipping, run database migrations, and manage authentication.
mastra lint --preflight
mastra migrate -y
mastra auth loginFor more information and full setup instructions, see:
