arcade-mcp/contrib/examples/mastra
Evan Tahler 83ec80c08f
Bumps critical JS dependency versions (#699)
Fixes a number of security issues with JS dependencies in our examples.
Does not upgrade to the latest versions of frameworks.
2025-12-01 18:38:22 -08:00
..
src/mastra Bumps critical JS dependency versions (#699) 2025-12-01 18:38:22 -08:00
.env.example General OSS health (#643) 2025-10-22 18:26:27 -07:00
.gitignore General OSS health (#643) 2025-10-22 18:26:27 -07:00
LICENSE General OSS health (#643) 2025-10-22 18:26:27 -07:00
package.json Bumps critical JS dependency versions (#699) 2025-12-01 18:38:22 -08:00
pnpm-lock.yaml Bumps critical JS dependency versions (#699) 2025-12-01 18:38:22 -08:00
README.md General OSS health (#643) 2025-10-22 18:26:27 -07:00
tsconfig.json General OSS health (#643) 2025-10-22 18:26:27 -07:00

Arcade - Mastra Example

License

Arcade DocumentationIntegrationsArcade JS ClientMastra

Arcade - Mastra Integration

This example demonstrates how to integrate Arcade with Mastra to create powerful AI agents. Arcade provides access to a wide range of tools including Gmail, Slack, LinkedIn, and more, while Mastra provides a robust framework for building AI agents with TypeScript.

For a list of all available tools and authentication options, see the Arcade Integrations documentation. You can also build custom tools with the Tool SDK as described in our documentation.

Prerequisites

Installation

  1. Install dependencies:
pnpm install
  1. Set up environment variables:
    • Copy .env.example to .env

    • Fill in your API keys:

      OPENAI_API_KEY=your_openai_api_key
      ARCADE_API_KEY=your_arcade_api_key
      

Basic Usage

This example demonstrates how to use Arcade's Gmail toolkit with Mastra to create an AI agent that can help users manage their email. The agent will access your Google account (after authorization) and perform various tasks based on user requests.

To get started:

  1. Start the Mastra playground:
pnpm dev
  1. Open your browser and navigate to http://localhost:4111/

The Mastra playground provides an interactive interface where you can:

  • Chat with your agent
  • Execute specific tools

Authorization

When using tools that require authorization, the agent will provide an authorization URL. You'll need to:

  1. Click on the authorization URL provided in the chat/execution interface
  2. Complete the authorization flow in your browser
  3. Return to the Mastra playground to continue your interaction

This authorization process is handled by the executeOrAuthorizeZodTool helper function, which checks if a tool requires authorization and returns the appropriate URL when needed. Once authorized, the tool will execute normally in subsequent requests without requiring re-authorization.

Development

To modify or extend the functionality:

  1. Update the userId in agents/gmail.ts with your application's user identification
  2. Modify the toolkit parameter in arcade.tools.list() to access different tools. Available toolkits include:
    • "gmail" - Gmail
    • "slack" - Slack messaging and channels
    • "github" - GitHub repositories and issues
    • And more in Arcade Integrations documentation

Security

  • Never commit your .env file
  • Use appropriate user identification in production

License

This project is licensed under the MIT License - see the LICENSE file for details.