// Run it by with a Mastra agent. // npm install @mastra/core @mastra/mcp // Env: RUNITBY_API_KEY (https://runitby.app/app/keys), ANTHROPIC_API_KEY import { Agent } from '@mastra/core/agent' import { MCPClient } from '@mastra/mcp' const mcp = new MCPClient({ servers: { runitby: { url: new URL('https://runitby.app/mcp'), requestInit: { headers: { Authorization: `Bearer ${process.env.RUNITBY_API_KEY}` } }, }, }, }) try { const agent = new Agent({ id: 'shipping-agent', name: 'Shipping agent', instructions: 'You collect details from people with Run it by.', model: 'anthropic/claude-sonnet-5-5', tools: await mcp.listTools(), }) const { text } = await agent.generate( 'Ask Jordan (jordan@example.com) for her shipping address: name, street, city, postal code ' + 'and country. Email her the link, then wait for her answer and print it.', { maxSteps: 20 }, ) console.log(text) } finally { await mcp.disconnect() }